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
149 150 151 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 149 def +(type, expr, other) Attribute[type].(sql_expr: expr.pg_array.concat(other)) end |
#any(_type, expr, value) ⇒ Object
125 126 127 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 125 def any(_type, expr, value) Attribute[SQL::Types::Bool].(sql_expr: { value => expr.pg_array.any }) end |
#contain(type, expr, other) ⇒ Object
117 118 119 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 117 def contain(type, expr, other) Attribute[SQL::Types::Bool].(sql_expr: expr.pg_array.contains(type[other])) end |
#contained_by(type, expr, other) ⇒ Object
129 130 131 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 129 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
121 122 123 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 121 def get(type, expr, idx) Attribute[type].(sql_expr: expr.pg_array[idx]) end |
#join(_type, expr, delimiter = '', null = nil) ⇒ Object
145 146 147 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 145 def join(_type, expr, delimiter = '', null = nil) Attribute[SQL::Types::String].(sql_expr: expr.pg_array.join(delimiter, null)) end |
#length(_type, expr) ⇒ Object
133 134 135 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 133 def length(_type, expr) Attribute[SQL::Types::Integer].(sql_expr: expr.pg_array.length) end |
#overlaps(type, expr, other_array) ⇒ Object
137 138 139 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 137 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
141 142 143 |
# File 'lib/rom/sql/extensions/postgres/types/array.rb', line 141 def remove_value(type, expr, value) Attribute[type].(sql_expr: expr.pg_array.remove(cast(type, value))) end |