module ROM::SQL::Types
Constants
- Blob
- PG
- SQLite
- Serial
- Void
Public Class Methods
ForeignKey(relation, type = Types::Integer.meta(index: true))
click to toggle source
Define a foreign key attribute type
@example with default Int type
attribute :user_id, Types.ForeignKey(:users)
@example with a custom type
attribute :user_id, Types.ForeignKey(:users, Types::UUID)
@return [Dry::Types::Nominal]
@api public
Calls superclass method
# File lib/rom/sql/types.rb, line 25 def self.ForeignKey(relation, type = Types::Integer.meta(index: true)) super end
define(value_type, &block)
click to toggle source
Define a complex attribute type using Type DSL
@example
attribute :meta, Types.define(Types::JSON) do input { Types::PG::JSON } output { Types::Coercible::Hash } end
@return [Dry::Types::Nominal]
@api public
# File lib/rom/sql/types.rb, line 40 def self.define(value_type, &block) TypeDSL.new(value_type).call(&block) end