Module: ROM::SQL::Postgres::Types::ArrayMethods
- Defined in:
- lib/rom/sql/extensions/postgres/types/array.rb
Instance Method Summary collapse
- #+(type, expr, other) ⇒ Object
- #any(type, expr, value) ⇒ Object
- #contain(type, expr, other) ⇒ Object
- #contained_by(type, expr, other) ⇒ Object
- #get(type, expr, idx) ⇒ Object
- #join(type, expr, delimiter = '', null = nil) ⇒ Object
- #length(type, expr) ⇒ Object
- #overlaps(type, expr, other_array) ⇒ Object
- #remove_value(type, expr, value) ⇒ Object
Instance Method Details
#+(type, expr, other) ⇒ Object
147 148 149 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 147 def +(type, expr, other) Attribute[type].(sql_expr: expr.pg_array.concat(other)) end |
#any(type, expr, value) ⇒ Object
123 124 125 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 123 def any(type, expr, value) Attribute[SQL::Types::Bool].(sql_expr: { value => expr.pg_array.any }) end |
#contain(type, expr, other) ⇒ Object
115 116 117 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 115 def contain(type, expr, other) Attribute[SQL::Types::Bool].(sql_expr: expr.pg_array.contains(type[other])) end |
#contained_by(type, expr, other) ⇒ Object
127 128 129 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 127 def contained_by(type, expr, other) Attribute[SQL::Types::Bool].(sql_expr: expr.pg_array.contained_by(type[other])) end |
#get(type, expr, idx) ⇒ Object
119 120 121 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 119 def get(type, expr, idx) Attribute[type].(sql_expr: expr.pg_array[idx]) end |
#join(type, expr, delimiter = '', null = nil) ⇒ Object
143 144 145 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 143 def join(type, expr, delimiter = '', null = nil) Attribute[SQL::Types::String].(sql_expr: expr.pg_array.join(delimiter, null)) end |
#length(type, expr) ⇒ Object
131 132 133 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 131 def length(type, expr) Attribute[SQL::Types::Int].(sql_expr: expr.pg_array.length) end |
#overlaps(type, expr, other_array) ⇒ Object
135 136 137 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 135 def overlaps(type, expr, other_array) Attribute[SQL::Types::Bool].(sql_expr: expr.pg_array.overlaps(type[other_array])) end |
#remove_value(type, expr, value) ⇒ Object
139 140 141 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 139 def remove_value(type, expr, value) Attribute[type].(sql_expr: expr.pg_array.remove(cast(type, value))) end |