Module: Torque::PostgreSQL::Adapter::ColumnMethods

Included in:
TableDefinition
Defined in:
lib/torque/postgresql/adapter/schema_definitions.rb

Instance Method Summary collapse

Instance Method Details

#composite(*names, composite_type:, **options) ⇒ Object

Add a composite type column to the table

Raises:

  • (ArgumentError)


22
23
24
25
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 22

def composite(*names, composite_type:, **options)
  raise ArgumentError, "Missing column name(s) for composite" if names.empty?
  names.each { |name| column(name, :composite, composite_type: composite_type, **options) }
end

#lquery(*names, **options) ⇒ Object

Add a label tree pattern column to the table

Raises:

  • (ArgumentError)


36
37
38
39
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 36

def lquery(*names, **options)
  raise ArgumentError, "Missing column name(s) for lquery" if names.empty?
  names.each { |name| column(name, :lquery, **options) }
end

#ltree(*names, **options) ⇒ Object

Add a label tree column to the table. Tree operators are only indexed by GiST, as in index: { using: :gist }, whose default operator class is already the right one for both a path and an array of paths

Raises:

  • (ArgumentError)


30
31
32
33
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 30

def ltree(*names, **options)
  raise ArgumentError, "Missing column name(s) for ltree" if names.empty?
  names.each { |name| column(name, :ltree, **options) }
end

#search_language(*names, **options) ⇒ Object

Adds a search language column to the table. See add_search_language

Raises:

  • (ArgumentError)


9
10
11
12
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 9

def search_language(*names, **options)
  raise ArgumentError, "Missing column name(s) for search_language" if names.empty?
  names.each { |name| column(name, :regconfig, **options) }
end

#search_vector(*names, columns:, **options) ⇒ Object

Add a search vector column to the table. See add_search_vector

Raises:

  • (ArgumentError)


15
16
17
18
19
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 15

def search_vector(*names, columns:, **options)
  raise ArgumentError, "Missing column name(s) for search_vector" if names.empty?
  options = Attributes::Builder.search_vector_options(columns: columns, **options)
  names.each { |name| column(name, :virtual, **options) }
end