Module molly.client
Module with default Molly client.
Functions
new () | Function that returns a default client implementation. |
Functions
- new ()
-
Function that returns a default client implementation.
Default implementation of a client defines open, setup, teardown and close methods with empty implementation that always returns true.
Client must implement the following methods:
open - function that open a connection to a database instance. Function must return a boolean value, true in case of success and false otherwise.
setup - function that set up a database instance. Function must return a boolean value, true in case of success and false otherwise.
invoke - function that accept an operation and invoke it on database instance, function should process user-defined types of operations and execute intended actions on databases. Function must return an operation after invokation.
teardown - function that tear down a database instance. Function must return a boolean value, true in case of success and false otherwise.
close - function that close connection to a database instance. Function must return a boolean value, true in case of success and false otherwise.
In general it is recommended to raise an error in case of fatal errors like failed database setup, teardown or connection and set status of operation to 'fail' when key is not found in database table etc.
Returns:
-
client
Usage:
local client = require('molly').client.new() client.invoke = function(op) return true end