This repository has been archived by the owner. It is now read-only.
rethinkdb.models
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
- Fork it ( https://github.com/BecauseOfProg/rethinkdb.models/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- Whaxion - creator, maintainer
Repository
rethinkdb.models
Owner
Statistic
- 3
- 0
- 1
- 0
- 0
- almost 6 years ago
- April 24, 2018
License
MIT License
Links
Synced at
Thu, 08 May 2025 18:17:32 GMT
Languages