Skip to content
Gabriel Francisco edited this page Jul 1, 2021 · 5 revisions

Usage

To create a model, create it with sqlier.Model

All methods passed to the Model will be available on child ModelInstances

Methods

  • Model(table baseinfo): Returns a new ModelInstance Object
  • Model:get(string identity, function callback(table data)): Gets one by identity
  • Model:find(table filter, function callback(table data)): Gets one by passed filters (aka {Name = "ceifa"})
  • Model:filter(table filter, function callback(table data)): Same as find, but gets many

Passthrough functions

These functions just call the driver method with themselves, see Drivers These should generally not be overwritten

  • Model:update(object, callback)
  • Model:increment(object, callback)
  • Model:decrement(object, callback)
  • Model:delete(identity, callback)
  • Model:insert(object, callback)

Builtin functions

These functions should not be overwritten/used unless you know what youre doing

  • Model:database(): Returns the database of the Model
  • Model:__validate(): Validates the schema of itself
  • Model:__build(table model): Builds model into base datatypes
Clone this wiki locally