Class: YbDDLParser::AST::Statement
- Inherits:
-
Data
- Object
- Data
- YbDDLParser::AST::Statement
- Defined in:
- lib/yb_ddl_parser/ast.rb
Instance Attribute Summary collapse
-
#access_method ⇒ Object
readonly
Returns the value of attribute access_method.
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#concurrently ⇒ Object
readonly
Returns the value of attribute concurrently.
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
-
#if_exists ⇒ Object
readonly
Returns the value of attribute if_exists.
-
#if_not_exists ⇒ Object
readonly
Returns the value of attribute if_not_exists.
-
#include_columns ⇒ Object
readonly
Returns the value of attribute include_columns.
-
#index_name ⇒ Object
readonly
Returns the value of attribute index_name.
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#new_name ⇒ Object
readonly
Returns the value of attribute new_name.
-
#object_type ⇒ Object
readonly
Returns the value of attribute object_type.
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#partition_bound_sql ⇒ Object
readonly
Returns the value of attribute partition_bound_sql.
-
#partition_of ⇒ Object
readonly
Returns the value of attribute partition_of.
-
#partition_spec ⇒ Object
readonly
Returns the value of attribute partition_spec.
-
#primary_key ⇒ Object
readonly
Returns the value of attribute primary_key.
-
#raw_node_type ⇒ Object
readonly
Returns the value of attribute raw_node_type.
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
-
#replica_placement_json ⇒ Object
readonly
Returns the value of attribute replica_placement_json.
-
#sql ⇒ Object
readonly
Returns the value of attribute sql.
-
#tablespace ⇒ Object
readonly
Returns the value of attribute tablespace.
-
#tablespace_location ⇒ Object
readonly
Returns the value of attribute tablespace_location.
-
#tablet_split ⇒ Object
readonly
Returns the value of attribute tablet_split.
-
#unique ⇒ Object
readonly
Returns the value of attribute unique.
-
#where_sql ⇒ Object
readonly
Returns the value of attribute where_sql.
Instance Method Summary collapse
- #alter_index? ⇒ Boolean
- #create_index? ⇒ Boolean
- #create_table? ⇒ Boolean
- #drop_index? ⇒ Boolean
- #drop_table? ⇒ Boolean
- #explicit_concurrently? ⇒ Boolean
- #hash_key_groups ⇒ Object
- #partition ⇒ Object
- #partition_child? ⇒ Boolean
- #partition_parent? ⇒ Boolean
- #split ⇒ Object
- #target_name ⇒ Object
- #target_relation ⇒ Object
- #target_relations ⇒ Object
Instance Attribute Details
#access_method ⇒ Object (readonly)
Returns the value of attribute access_method
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def access_method @access_method end |
#columns ⇒ Object (readonly)
Returns the value of attribute columns
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def columns @columns end |
#commands ⇒ Object (readonly)
Returns the value of attribute commands
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def commands @commands end |
#concurrently ⇒ Object (readonly)
Returns the value of attribute concurrently
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def concurrently @concurrently end |
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def constraints @constraints end |
#if_exists ⇒ Object (readonly)
Returns the value of attribute if_exists
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def if_exists @if_exists end |
#if_not_exists ⇒ Object (readonly)
Returns the value of attribute if_not_exists
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def if_not_exists @if_not_exists end |
#include_columns ⇒ Object (readonly)
Returns the value of attribute include_columns
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def include_columns @include_columns end |
#index_name ⇒ Object (readonly)
Returns the value of attribute index_name
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def index_name @index_name end |
#keys ⇒ Object (readonly)
Returns the value of attribute keys
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def keys @keys end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def kind @kind end |
#location ⇒ Object (readonly)
Returns the value of attribute location
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def name @name end |
#new_name ⇒ Object (readonly)
Returns the value of attribute new_name
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def new_name @new_name end |
#object_type ⇒ Object (readonly)
Returns the value of attribute object_type
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def object_type @object_type end |
#objects ⇒ Object (readonly)
Returns the value of attribute objects
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def objects @objects end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def owner @owner end |
#partition_bound_sql ⇒ Object (readonly)
Returns the value of attribute partition_bound_sql
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def partition_bound_sql @partition_bound_sql end |
#partition_of ⇒ Object (readonly)
Returns the value of attribute partition_of
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def partition_of @partition_of end |
#partition_spec ⇒ Object (readonly)
Returns the value of attribute partition_spec
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def partition_spec @partition_spec end |
#primary_key ⇒ Object (readonly)
Returns the value of attribute primary_key
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def primary_key @primary_key end |
#raw_node_type ⇒ Object (readonly)
Returns the value of attribute raw_node_type
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def raw_node_type @raw_node_type end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def relation @relation end |
#replica_placement_json ⇒ Object (readonly)
Returns the value of attribute replica_placement_json
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def replica_placement_json @replica_placement_json end |
#sql ⇒ Object (readonly)
Returns the value of attribute sql
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def sql @sql end |
#tablespace ⇒ Object (readonly)
Returns the value of attribute tablespace
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def tablespace @tablespace end |
#tablespace_location ⇒ Object (readonly)
Returns the value of attribute tablespace_location
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def tablespace_location @tablespace_location end |
#tablet_split ⇒ Object (readonly)
Returns the value of attribute tablet_split
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def tablet_split @tablet_split end |
#unique ⇒ Object (readonly)
Returns the value of attribute unique
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def unique @unique end |
#where_sql ⇒ Object (readonly)
Returns the value of attribute where_sql
29 30 31 |
# File 'lib/yb_ddl_parser/ast.rb', line 29 def where_sql @where_sql end |
Instance Method Details
#alter_index? ⇒ Boolean
77 78 79 |
# File 'lib/yb_ddl_parser/ast.rb', line 77 def alter_index? kind == :alter_index end |
#create_index? ⇒ Boolean
65 66 67 |
# File 'lib/yb_ddl_parser/ast.rb', line 65 def create_index? kind == :create_index end |
#create_table? ⇒ Boolean
61 62 63 |
# File 'lib/yb_ddl_parser/ast.rb', line 61 def create_table? kind == :create_table end |
#drop_index? ⇒ Boolean
73 74 75 |
# File 'lib/yb_ddl_parser/ast.rb', line 73 def drop_index? kind == :drop && object_type == :index end |
#drop_table? ⇒ Boolean
69 70 71 |
# File 'lib/yb_ddl_parser/ast.rb', line 69 def drop_table? kind == :drop && object_type == :table end |
#explicit_concurrently? ⇒ Boolean
89 90 91 |
# File 'lib/yb_ddl_parser/ast.rb', line 89 def explicit_concurrently? concurrently == :explicit end |
#hash_key_groups ⇒ Object
108 109 110 111 112 113 114 115 116 117 |
# File 'lib/yb_ddl_parser/ast.rb', line 108 def hash_key_groups groups = keys.each_with_object({}) do |key, grouped| next if key.hash_group.nil? grouped[key.hash_group] ||= [] grouped[key.hash_group] << (key.name || key.expression) end groups.keys.sort.map { |group| groups.fetch(group) } end |
#partition ⇒ Object
123 124 125 |
# File 'lib/yb_ddl_parser/ast.rb', line 123 def partition partition_spec end |
#partition_child? ⇒ Boolean
85 86 87 |
# File 'lib/yb_ddl_parser/ast.rb', line 85 def partition_child? !partition_of.nil? end |
#partition_parent? ⇒ Boolean
81 82 83 |
# File 'lib/yb_ddl_parser/ast.rb', line 81 def partition_parent? create_table? && !partition_spec.nil? && !partition_child? end |
#split ⇒ Object
119 120 121 |
# File 'lib/yb_ddl_parser/ast.rb', line 119 def split tablet_split end |
#target_name ⇒ Object
104 105 106 |
# File 'lib/yb_ddl_parser/ast.rb', line 104 def target_name index_name || target_relation&.qualified_name || name end |
#target_relation ⇒ Object
100 101 102 |
# File 'lib/yb_ddl_parser/ast.rb', line 100 def target_relation target_relations.first end |
#target_relations ⇒ Object
93 94 95 96 97 98 |
# File 'lib/yb_ddl_parser/ast.rb', line 93 def target_relations return objects unless objects.empty? return [relation] if relation [] end |