Sha256: ac334e662c5fae9e500ba20a863a111519e4e1081542def1f9da724ac94e52a5

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

require 'sequel'
require 'consty'
require 'time'
require 'timing'
require 'class_config'

require_relative 'db/version'
require_relative 'db/helpers'
require_relative 'db/query'
require_relative 'db/relations/graph_builder'
require_relative 'db/relations/base'
require_relative 'db/relations/one_to_many'
require_relative 'db/relations/one_to_one'
require_relative 'db/relations/many_to_one'
require_relative 'db/relations/many_to_many'
require_relative 'db/collection'
require_relative 'db/model'
require_relative 'db/type_converters/time_in_zone'
require_relative 'db/type_converters/postgres_types/array'
require_relative 'db/type_converters/postgres_types/hstore'
require_relative 'db/type_converters/postgres_types/json'
require_relative 'db/type_converters/postgres_types/jsonb'
require_relative 'db/type_converters/postgres'

module Rasti
  module DB
    
    extend ClassConfig

    attr_config :type_converters, []

    def self.to_db(db, collection_name, attribute_name, value)
      type_converters.inject(value) do |result, type_converter|
        type_converter.to_db db, collection_name, attribute_name, result
      end
    end

    def self.from_db(value)
      type_converters.inject(value) do |result, type_converter|
        type_converter.from_db result
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rasti-db-1.1.1 lib/rasti/db.rb
rasti-db-1.1.0 lib/rasti/db.rb
rasti-db-1.0.0 lib/rasti/db.rb