Class: Nandi::Instructions::CreateTable::ColumnsReader

Inherits:
Object
  • Object
show all
Defined in:
lib/nandi/instructions/create_table.rb

Constant Summary collapse

TYPES =
%i[
  bigint
  binary
  boolean
  date
  datetime
  decimal
  float
  integer
  json
  string
  text
  time
  timestamp
  virtual
  bigserial bit bit_varying box
  cidr circle citext
  daterange
  hstore
  inet int4range int8range interval
  jsonb
  line lseg ltree
  macaddr money
  numrange
  oid
  path point polygon primary_key
  serial
  tsrange tstzrange tsvector
  uuid
  xml
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeColumnsReader

Returns a new instance of ColumnsReader.



62
63
64
65
# File 'lib/nandi/instructions/create_table.rb', line 62

def initialize
  @columns = []
  @timestamps_args = nil
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



28
29
30
# File 'lib/nandi/instructions/create_table.rb', line 28

def columns
  @columns
end

#timestamps_argsObject (readonly)

Returns the value of attribute timestamps_args.



28
29
30
# File 'lib/nandi/instructions/create_table.rb', line 28

def timestamps_args
  @timestamps_args
end

Instance Method Details

#column(name, type, **args) ⇒ Object



67
68
69
# File 'lib/nandi/instructions/create_table.rb', line 67

def column(name, type, **args)
  @columns << Column.new(name: name, type: type, args: args)
end

#timestamps(**args) ⇒ Object



71
72
73
# File 'lib/nandi/instructions/create_table.rb', line 71

def timestamps(**args)
  @timestamps_args = args
end