Class: ActiveRecordSpannerAdapter::Index::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord_spanner_adapter/index/column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_name, index_name, name, schema_name: "", order: nil, ordinal_position: nil) ⇒ Column

Returns a new instance of Column.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/activerecord_spanner_adapter/index/column.rb', line 17

def initialize \
    table_name,
    index_name,
    name,
    schema_name: "",
    order: nil,
    ordinal_position: nil
  @table_name = table_name.to_s
  @index_name = index_name.to_s
  @schema_name = schema_name.to_s
  @name = name.to_s
  @order = order.to_s.upcase if order
  @ordinal_position = ordinal_position
end

Instance Attribute Details

#index_nameObject

Returns the value of attribute index_name.



12
13
14
# File 'lib/activerecord_spanner_adapter/index/column.rb', line 12

def index_name
  @index_name
end

#nameObject

Returns the value of attribute name.



13
14
15
# File 'lib/activerecord_spanner_adapter/index/column.rb', line 13

def name
  @name
end

#orderObject

Returns the value of attribute order.



14
15
16
# File 'lib/activerecord_spanner_adapter/index/column.rb', line 14

def order
  @order
end

#ordinal_positionObject

Returns the value of attribute ordinal_position.



15
16
17
# File 'lib/activerecord_spanner_adapter/index/column.rb', line 15

def ordinal_position
  @ordinal_position
end

#schema_nameObject

Returns the value of attribute schema_name.



11
12
13
# File 'lib/activerecord_spanner_adapter/index/column.rb', line 11

def schema_name
  @schema_name
end

#table_nameObject

Returns the value of attribute table_name.



10
11
12
# File 'lib/activerecord_spanner_adapter/index/column.rb', line 10

def table_name
  @table_name
end

Instance Method Details

#desc!Object



40
41
42
# File 'lib/activerecord_spanner_adapter/index/column.rb', line 40

def desc!
  @order = "DESC"
end

#desc?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/activerecord_spanner_adapter/index/column.rb', line 36

def desc?
  @order == "DESC"
end

#storing?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/activerecord_spanner_adapter/index/column.rb', line 32

def storing?
  @ordinal_position.nil?
end