Class: ActiveRecord::ConnectionAdapters::CipherStashPG::Column
- Inherits:
-
ConnectionAdapters::Column
- Object
- ConnectionAdapters::Column
- ActiveRecord::ConnectionAdapters::CipherStashPG::Column
- Defined in:
- lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb,
lib/active_record/connection_adapters/7.0/cipherstash_pg/column.rb,
lib/active_record/connection_adapters/7.1/cipherstash_pg/column.rb
Overview
:nodoc:
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #array ⇒ Object (also: #array?)
- #encode_with(coder) ⇒ Object
- #enum? ⇒ Boolean
- #has_default? ⇒ Boolean
- #hash ⇒ Object
- #init_with(coder) ⇒ Object
-
#initialize(serial: nil, generated: nil) ⇒ Column
constructor
A new instance of Column.
- #serial? ⇒ Boolean (also: #auto_incremented_by_db?)
- #sql_type ⇒ Object
- #virtual? ⇒ Boolean
Constructor Details
#initialize(serial: nil, generated: nil) ⇒ Column
Returns a new instance of Column.
11 12 13 14 |
# File 'lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb', line 11 def initialize(*, serial: nil, **) super @serial = serial end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
39 40 41 42 43 |
# File 'lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb', line 39 def ==(other) other.is_a?(Column) && super && serial? == other.serial? end |
#array ⇒ Object Also known as: array?
20 21 22 |
# File 'lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb', line 20 def array .sql_type.end_with?("[]") end |
#encode_with(coder) ⇒ Object
34 35 36 37 |
# File 'lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb', line 34 def encode_with(coder) coder["serial"] = @serial super end |
#enum? ⇒ Boolean
35 36 37 |
# File 'lib/active_record/connection_adapters/7.0/cipherstash_pg/column.rb', line 35 def enum? type == :enum end |
#has_default? ⇒ Boolean
26 27 28 |
# File 'lib/active_record/connection_adapters/7.0/cipherstash_pg/column.rb', line 26 def has_default? super && !virtual? end |
#hash ⇒ Object
46 47 48 49 50 |
# File 'lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb', line 46 def hash Column.hash ^ super.hash ^ serial?.hash end |
#init_with(coder) ⇒ Object
29 30 31 32 |
# File 'lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb', line 29 def init_with(coder) @serial = coder["serial"] super end |
#serial? ⇒ Boolean Also known as: auto_incremented_by_db?
16 17 18 |
# File 'lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb', line 16 def serial? @serial end |
#sql_type ⇒ Object
25 26 27 |
# File 'lib/active_record/connection_adapters/6.1/cipherstash_pg/column.rb', line 25 def sql_type super.delete_suffix("[]") end |
#virtual? ⇒ Boolean
21 22 23 24 |
# File 'lib/active_record/connection_adapters/7.0/cipherstash_pg/column.rb', line 21 def virtual? # We assume every generated column is virtual, no matter the concrete type @generated.present? end |