class Sequel::Amalgalite::SequelTypeMap

Type conversion map class for Sequel’s use of Amalgamite

def blob(s)

Amalgamite::Blob
Return blobs as instances of Sequel::SQL::Blob instead of
def blob(s)
  SQL::Blob.new(s)
end

def datetime(s)

Return datetime types as instances of Sequel.datetime_class
def datetime(s)
  @db.to_application_timestamp(s)
end

def decimal(s)

instead of Float
Return numeric/decimal types as instances of BigDecimal
def decimal(s)
  BigDecimal.new(s)
end

def initialize(db)

handle the database timezone.
Store the related database object, in order to be able to correctly
def initialize(db)
  @db = db
end

def result_value_of(declared_type, value)

type doesn't match a known type, just return the value.
Don't raise an error if the value is a string and the declared
def result_value_of(declared_type, value)
  if value.is_a?(::Amalgalite::Blob)
    SQL::Blob.new(value.to_s)
  elsif value.is_a?(String) && declared_type
    (meth = self.class.sql_to_method(declared_type.downcase)) ? send(meth, value) : value
  else
    super
  end
end

def time(s)

def time(s)
  Sequel.string_to_time(s)
end