Project

lazy_store

0.0
No commit activity in last 3 years
No release in over 3 years
port of lazy records to ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 2.0.1
~> 3.12
~> 3.0.0.rc1

Runtime

 Project Readme

PLEASE NOTE - This project is not being actively maintained at the moment - I am taking a break - not sure when I will return.

Lazy Records for Ruby

This is a port of the java functional library Lazy Records to the ruby language. It still needs a lot of tidy and re-working in several places. But it works and is a first cut.

Summary

  • Tries to be as lazy as possible
  • Supports method chaining
  • Is primarily based on totally lazy

Install

This gem requires ruby 2.x.x

In your bundler Gemfile

 gem lazy_records, '~>0.0.1' 

Or with rubygems

 gem install lazy_records

Examples

The following are some simple examples of the currently implemented functionality.

With MemoryRecords (Run in memory only)

require 'lazy_records'

name = keyword(:name)
age = keyword(:age)
people = definition(:people, name, age)

records = MemoryRecords.new

records.add(people, sequence(
record(name, 'kostas', age, 25),
record(name, 'kings', age, 34)))

records.get(people).count # returns 2
records.get(people).head.name) # returns 'kostas'

with SqlRecords (Run against either mysql or mssql currently)

require 'lazy_records'
require 'adpaters/mysql'

name = keyword(:name)
age = keyword(:age)
people = definition(:people, name, age)

records = SqlRecords.new(Mysql.new(username:'user1',password:'pass1',database:'mydb'))

records.add(people, sequence(
record(name, 'kostas', age, 25),
record(name, 'kings', age, 34)))

records.get(people).count # returns 2
records.get(people).head.name) # returns 'kostas'