Class: Webhookdb::DBAdapter::Column

Inherits:
TypedStruct show all
Includes:
ColumnTypes
Defined in:
lib/webhookdb/db_adapter.rb

Constant Summary

Constants included from ColumnTypes

Webhookdb::DBAdapter::ColumnTypes::BIGINT, Webhookdb::DBAdapter::ColumnTypes::BIGINT_ARRAY, Webhookdb::DBAdapter::ColumnTypes::BOOLEAN, Webhookdb::DBAdapter::ColumnTypes::COLUMN_TYPES, Webhookdb::DBAdapter::ColumnTypes::DATE, Webhookdb::DBAdapter::ColumnTypes::DECIMAL, Webhookdb::DBAdapter::ColumnTypes::DOUBLE, Webhookdb::DBAdapter::ColumnTypes::FLOAT, Webhookdb::DBAdapter::ColumnTypes::INTEGER, Webhookdb::DBAdapter::ColumnTypes::INTEGER_ARRAY, Webhookdb::DBAdapter::ColumnTypes::OBJECT, Webhookdb::DBAdapter::ColumnTypes::TEXT, Webhookdb::DBAdapter::ColumnTypes::TEXT_ARRAY, Webhookdb::DBAdapter::ColumnTypes::TIMESTAMP, Webhookdb::DBAdapter::ColumnTypes::UUID

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from TypedStruct

#[], #_apply, #as_json, #change

Constructor Details

#initialize(**kwargs) ⇒ Column

Returns a new instance of Column.

Raises:

  • (ArgumentError)


45
46
47
48
49
50
51
52
53
54
# File 'lib/webhookdb/db_adapter.rb', line 45

def initialize(**kwargs)
  super
  self.typecheck!(:name, Symbol)
  self.typecheck!(:type, Symbol)
  self.typecheck!(:nullable, :boolean)
  self.typecheck!(:unique, :boolean)
  self.typecheck!(:index, :boolean)
  self.typecheck!(:pk, :boolean)
  raise ArgumentError, "type #{self.type.inspect} is not known" unless COLUMN_TYPES.include?(self.type)
end

Instance Attribute Details

#backfill_exprObject (readonly)

Returns the value of attribute backfill_expr.



39
40
41
# File 'lib/webhookdb/db_adapter.rb', line 39

def backfill_expr
  @backfill_expr
end

#backfill_statementObject (readonly)

Returns the value of attribute backfill_statement.



39
40
41
# File 'lib/webhookdb/db_adapter.rb', line 39

def backfill_statement
  @backfill_statement
end

#indexObject (readonly) Also known as: index?

Returns the value of attribute index.



39
40
41
# File 'lib/webhookdb/db_adapter.rb', line 39

def index
  @index
end

#index_whereObject (readonly)

Returns the value of attribute index_where.



39
40
41
# File 'lib/webhookdb/db_adapter.rb', line 39

def index_where
  @index_where
end

#nameObject (readonly)

Returns the value of attribute name.



39
40
41
# File 'lib/webhookdb/db_adapter.rb', line 39

def name
  @name
end

#nullableObject (readonly) Also known as: nullable?

Returns the value of attribute nullable.



39
40
41
# File 'lib/webhookdb/db_adapter.rb', line 39

def nullable
  @nullable
end

#pkObject (readonly) Also known as: pk?

Returns the value of attribute pk.



39
40
41
# File 'lib/webhookdb/db_adapter.rb', line 39

def pk
  @pk
end

#typeObject (readonly)

Returns the value of attribute type.



39
40
41
# File 'lib/webhookdb/db_adapter.rb', line 39

def type
  @type
end

#uniqueObject (readonly) Also known as: unique?

Returns the value of attribute unique.



39
40
41
# File 'lib/webhookdb/db_adapter.rb', line 39

def unique
  @unique
end

Instance Method Details

#_defaultsObject



56
57
58
# File 'lib/webhookdb/db_adapter.rb', line 56

def _defaults
  return {nullable: true, unique: false, index: false, pk: false}
end