-
Notifications
You must be signed in to change notification settings - Fork 3
Drivers
Garry but Spinning edited this page Jul 1, 2021
·
4 revisions
-
mysqloo: Requires the MySQLOO Module, Also requiresconninfo -
sqlite: No requirements, uses builtin SQL -
file: Uses files to store data instead of SQL -
memory: Store all data in RAM, fast but not persistent -
cache: Based in 2 drivers, source and cache, one for fast picks and one to persist the data
I highly recommend you use SQLite as an example
- Create a file in
sqlier/drivers/, this files name will be the name of your driver (akasqlier/drivers/mysqloo.lua) - From that file return a table with the following methods
-
initialize(table options): Called when driver is included -
validateSchema(table schema): Called when the schema needs to be validated -
get(table schema, string identity, function callback(data)): Same as Model:get(identity, callback) -
find(table schema, string filter, function callback(table data)): Same as Model:find(filter, callback) -
filter(table schema, string filter, function callback(table data)): Same as Model:filter(filter, callback) -
update(table schema, table object, function callback): Updates an object -
increment(table schema, table object, function callback): Atomically increments an object -
decrement(table schema, table object, function callback): Atomically decrements an object -
delete(table schema, table identity, function callback(table identity)): Deletes an object from the schema table -
insert(table schema, table object, function callback(last_insert_rowid)): Inserts a value into the schema table
-
- Done :)