UNPKG

reheat

Version:

A red hot Node.js ORM for RethinkDB.

76 lines (62 loc) 1.19 kB
@doc overview @id index @name Reheat API @description # Reheat API Classes provided by Reheat: ### Reheat ```js var reheat = require('reheat'); ``` ### Connection ```js // Connection constructor function reheat.Connection; var connection = new reheat.Connection({ host: '123.45.67.890' }); ``` ### Schema ```js var personSchema = reheat.defineSchema('PersonSchema', { name: { type: 'string' } }); ``` ### Model ```js var Person = reheat.defineModel('Person', { connection: connection, schema: personSchema }); ``` Person.collection; // Default collection already defined ```js var person = new Person({ name: 'John Anderson' }); ``` ### Collection ```js // This is optional. A default collection is defined for // every model you define. var Posts = reheat.defineCollection('Posts', { model: Post }); ``` ```js var posts = new Posts([ { author: 'John Anderson', title: 'How NOT to cook' }, { author: 'Sally Johnson', title: 'How to cook' }, ]); ``` ### Errors ```js // Error constructor functions reheat.support.UnhandledError; reheat.support.IllegalArgumentError; reheat.support.RuntimeError; reheat.support.ValidationError; ``` <page-list></page-list>