Module: Relationizer::Postgresql
- Defined in:
- lib/relationizer/postgresql.rb
Defined Under Namespace
Classes: ReasonlessTypeError
Constant Summary collapse
- DEFAULT_TYPES =
-> (obj) { case obj when Integer :INT8 when BigDecimal :DECIMAL when Float :FLOAT8 when String :TEXT when TrueClass :BOOLEAN when FalseClass :BOOLEAN when Time :TIMESTAMPTZ when DateTime :TIMESTAMPTZ when Date :DATE else nil end }
Instance Method Summary collapse
Instance Method Details
#create_relation_literal(schema, tuples) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/relationizer/postgresql.rb', line 33 def create_relation_literal(schema, tuples) _select_exp = select_exp(schema, tuples) tuples_exp = tuples.map { |tuple| tuple. map(&method(:to_text_literal)). join(", "). tap { |t| break "(#{t})" } }.join(", ") schema_exp = schema.keys.map(&method(:identifer_quote)).join(", ") "SELECT #{_select_exp} FROM (VALUES#{tuples_exp}) AS t(#{schema_exp})" end |