-
-
Notifications
You must be signed in to change notification settings - Fork 0
Glossary: Module
Аниса edited this page Dec 18, 2022
·
6 revisions
Want to create your own modules instead of the ones we shipped within DBify? Panic no more, we've prepared support for custom modules already to suit various strategies!
Managing database never been easier: Specify your module structure & get the module ready in matter of seconds with all essential methods as noted down below inherited automatically for you to get started 😃.
local table: cModule = dbify.createModule({
moduleName = "yourModuleName", --Used for accessing module globally via `dbify.module.yourModuleName`
tableName = "yourtablename", --Name of table to create for the specified module
structure = {
--Structure based on which the table shall be created
{"id", "BIGINT AUTO_INCREMENT PRIMARY KEY"},
{"name", "TEXT NOT NULL"},
{"age", "INT"},
{"country", "TEXT DEFAULT='N/A'"}
}
})
local table: result, table: arguments = cModule.fetchAll(
table: {
--Conditional datas to be used for the query
{string: columnName, ~: columnValue},
...
},
bool: isSoloFetch, --Enabling this returns only first row of the retrieved result
~: ...arguments
)
local bool: result, table: arguments = cModule.create(
~: ...values, --Values should be passed in the same order as specified within the structure; Primary key is omitted if its an auto incrementing key
~: ...arguments
)
local bool: result, table: arguments = cModule.delete(
~: identifier,
~: ...arguments
)
local bool: result, table: arguments = cModule.setData(
~: identifier,
table: {
--Columns to be updated w/ their respective values
{string: columnName, ~: columnValue},
...
},
~: ...arguments
)
local table: result, table: arguments = cModule.getData(
~: identifier,
table: {
--Columns whose values are to be retrieved
string: columnName,
...
},
~: ...arguments
)