Skip to content

Latest commit

 

History

History
26 lines (25 loc) · 802 Bytes

README.md

File metadata and controls

26 lines (25 loc) · 802 Bytes

rom-playground

# Configure is optional, memory adapter is default
Core.configure do |config|
  config.adapter = :sql
  config.dsn = 'sqlite::memory'
end
Core.load.finalize
Core.command(:users).create.call(name: 'test', email: '[email protected]')
Core.command(:users).create.call(name: 'test1', email: '[email protected]')
Core.command(:users).create.call(name: 'test2', email: '[email protected]')
Core.relation(:users).
  filter(:name, :gt, 'test').
  offset(1).
  limit(1).
  as(:entity).
  to_a # => [#<Core::Models::User:0x007f1de86da468 @name="test2", @email="[email protected]">]
Core.relation(:users).
  filter(:name, :gt, 'test').
  order(:name, :desc).
  offset(1).
  limit(1).
  as(:entity).
  to_a # => [#<Core::Models::User:0x007fed7e526e30 @name="test1", @email="[email protected]">]