Class: Webhookdb::DBAdapter::Column
- Inherits:
-
TypedStruct
- Object
- TypedStruct
- Webhookdb::DBAdapter::Column
- 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
-
#backfill_expr ⇒ Object
readonly
Returns the value of attribute backfill_expr.
-
#backfill_statement ⇒ Object
readonly
Returns the value of attribute backfill_statement.
-
#index ⇒ Object
(also: #index?)
readonly
Returns the value of attribute index.
-
#index_where ⇒ Object
readonly
Returns the value of attribute index_where.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nullable ⇒ Object
(also: #nullable?)
readonly
Returns the value of attribute nullable.
-
#pk ⇒ Object
(also: #pk?)
readonly
Returns the value of attribute pk.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#unique ⇒ Object
(also: #unique?)
readonly
Returns the value of attribute unique.
Instance Method Summary collapse
- #_defaults ⇒ Object
-
#initialize(**kwargs) ⇒ Column
constructor
A new instance of Column.
Methods inherited from TypedStruct
#[], #_apply, #as_json, #change
Constructor Details
#initialize(**kwargs) ⇒ Column
Returns a new instance of Column.
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/webhookdb/db_adapter.rb', line 41 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_expr ⇒ Object (readonly)
Returns the value of attribute backfill_expr.
35 36 37 |
# File 'lib/webhookdb/db_adapter.rb', line 35 def backfill_expr @backfill_expr end |
#backfill_statement ⇒ Object (readonly)
Returns the value of attribute backfill_statement.
35 36 37 |
# File 'lib/webhookdb/db_adapter.rb', line 35 def backfill_statement @backfill_statement end |
#index ⇒ Object (readonly) Also known as: index?
Returns the value of attribute index.
35 36 37 |
# File 'lib/webhookdb/db_adapter.rb', line 35 def index @index end |
#index_where ⇒ Object (readonly)
Returns the value of attribute index_where.
35 36 37 |
# File 'lib/webhookdb/db_adapter.rb', line 35 def index_where @index_where end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
35 36 37 |
# File 'lib/webhookdb/db_adapter.rb', line 35 def name @name end |
#nullable ⇒ Object (readonly) Also known as: nullable?
Returns the value of attribute nullable.
35 36 37 |
# File 'lib/webhookdb/db_adapter.rb', line 35 def nullable @nullable end |
#pk ⇒ Object (readonly) Also known as: pk?
Returns the value of attribute pk.
35 36 37 |
# File 'lib/webhookdb/db_adapter.rb', line 35 def pk @pk end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
35 36 37 |
# File 'lib/webhookdb/db_adapter.rb', line 35 def type @type end |
#unique ⇒ Object (readonly) Also known as: unique?
Returns the value of attribute unique.
35 36 37 |
# File 'lib/webhookdb/db_adapter.rb', line 35 def unique @unique end |
Instance Method Details
#_defaults ⇒ Object
52 53 54 |
# File 'lib/webhookdb/db_adapter.rb', line 52 def _defaults return {nullable: true, unique: false, index: false, pk: false} end |