Skip to content

Module: Account

Аниса edited this page Jun 16, 2022 · 34 revisions

━ What's the Objective?

This module synchronizes built in MTA accounts w/ MySQL & provides a management interface for integrated w/ your resources. This module can either be used for custom accounts with automated sync disabled or work with correlation with default accounts otherwise. For automated syncing refer

━ APIs

⚠️ Disclaimer:

Syntax #2 should only be used in conjunction w/ thread

━ dbify.account.fetchAll() (Server)

@Objective: Fetches all existing accounts.
--Syntax #1:
local bool: state = dbify.account.fetchAll(
  table: {
    --These are conditional datas that has to be used for the query
    {string: columnName, ~: columnValue},
  },
  function: callback(table: result, table: arguments),
  ~: ...arguments
)

--Syntax #2:
local table: result, table: arguments = self:await(dbify.account.fetchAll(
  thread: self,
  table: {
    --These are conditional datas that has to be used for the query
    {string: columnName, ~: columnValue},
  },
  ~: ...arguments
))

━ dbify.account.create() (Server)

@Objective: Creates a new account.
dbify.account.create(accountName, callback(result, arguments)
    print(tostring(result))
    print(toJSON(arguments))
end, ...)

━ dbify.account.delete() (Server)

@Objective: Deletes an existing account.
dbify.account.delete(accountName, callback(result, arguments)
    print(tostring(result))
    print(toJSON(arguments))
end, ...)

━ dbify.account.setData() (Server)

@Objective: Sets account datas of a valid account.
dbify.account.setData(accountName, {
    --These are account datas to be updated
    {dataName1, dataValue1},
    {dataName2, dataValue2},
    ...
}, callback(result, arguments)
    print(tostring(result))
    print(toJSON(arguments))
end, ...)

━ dbify.account.getData() (Server)

@Objective: Retrieves account datas of a valid account.
dbify.account.getData(accountName, {
    --These are account datas to be retrieved
    dataName1,
    dataName2,
    ...
}, callback(result, arguments)
    print(toJSON(result))
    print(toJSON(arguments))
end, ...)
Clone this wiki locally