class Sequel::Postgres::PGArray

Represents a PostgreSQL array column value.

def _literal_append(sql, ds, array)

entries with ,.
arrays, surrounding each with [] and interspersing
Recursive method that handles multi-dimensional
def _literal_append(sql, ds, array)
  sql << '['
  comma = false
  commas = ','
  array.each do |i|
    sql << commas if comma
    if i.is_a?(Array)
      _literal_append(sql, ds, i)
    else
      ds.literal_append(sql, i)
    end
    comma = true
  end
  sql << ']'
end

def initialize(array, type=nil)

Set the array to delegate to, and a database type.
def initialize(array, type=nil)
  super(array)
  @array_type = type
end

def op

the PostgreSQL array functions and operators with literal arrays.
Wrap the PGArray instance in an ArrayOp, allowing you to easily use
def op
  ArrayOp.new(self)
end

def sequel_auto_param_type(ds)

can be automatically parameterized.
Allow automatic parameterization of the receiver if all elements can be
def sequel_auto_param_type(ds)
  if array_type && all?{|x| nil == x || ds.send(:auto_param_type, x)}
    "::#{array_type}[]"
  end
end

def sql_literal_append(ds, sql)

database array type.
If the receiver has a type, add a cast to the
Append the array SQL to the given sql string.
def sql_literal_append(ds, sql)
  at = array_type
  if empty? && at
    sql << "'{}'"
  else
    sql << "ARRAY"
    _literal_append(sql, ds, to_a)
  end
  if at
    sql << '::' << at.to_s << '[]'
  end
end