Method: Sequel::Postgres::PGRowOp#splat

Defined in:
lib/sequel/extensions/pg_row_ops.rb

#splat(cast_to = nil) ⇒ Object

Use the (identifier.*) syntax to indicate that this expression represents the composite type of one of the tables being referenced, if it has the same name as one of the columns. If the cast_to argument is given, also cast the expression to that type (which should be a symbol representing the composite type). This is used if you want to return whole table row as a composite type.

Sequel.pg_row_op(:a).splat[:b] # (a.*).b
Sequel.pg_row_op(:a).splat(:a) # (a.*)::a
[View source]

142
143
144
145
146
147
148
149
150
151
152
# File 'lib/sequel/extensions/pg_row_ops.rb', line 142

def splat(cast_to=nil)
  if args.length > 1
    raise Error, 'cannot splat a PGRowOp with multiple arguments'
  end

  if cast_to
    PGRowOp.new(ROW_CAST, args + [cast_to])
  else
    PGRowOp.new(ROW, args)
  end
end