Skip to content
This repository has been archived by the owner on Jul 26, 2019. It is now read-only.

A really simple ORM (only fetch, save and destroy) for RethinkDB in Crystal

License

Notifications You must be signed in to change notification settings

BecauseOfProg/rethinkdb.models

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rethinkdb.models

⚠ Because I don't use RethinkDB anymore this project is DISCONTINUED ⚠

A really simple ORM (only fetch, save and destroy) for RethinkDB in Crystal

Installation

Add this to your application's shard.yml:

dependencies:
  rethinkdb.models:
    github: BecauseOfProg/rethinkdb.models

Usage

require "rethinkdb.models"

# Start connection to database
RethinkDB::Db.setup({:host => "rethinkdb"})

# Create Model
class Person < RethinkDB::Model
  fields({
    name: String, # name: type
    age: Int32,
    defaults: {age: 15} # defaults: {name: value}
  })
end

# Create and save Person
person = Person.new(name: "Oliver", age: 20)
person.save

# Change value of one field
person.name = "Laurent"
person.save

# Destroy
person.destroy

# Fetch a Person
Person.fetch(id)

Contributing

  1. Fork it ( https:/BecauseOfProg/rethinkdb.models/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

About

A really simple ORM (only fetch, save and destroy) for RethinkDB in Crystal

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published