Skip to content

Module: Account

Аниса edited this page Dec 6, 2022 · 34 revisions

━ What's the Objective?

This module synchronizes built in MTA accounts w/ MySQL & provides a management interface to integrate w/ your resources. Module can either be used for custom accounts (Automated sync has to be disabled for this case) or work in correlation with default accounts otherwise (Automated sync has to be enabled for this case). For modifying automated sync's state 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),
  table: 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},
  },
  table: arguments
))

━ dbify.account.create() (Server)

@Objective: Creates a new account.
--Syntax #1:
local bool: state = dbify.account.create(
  string: accountName,
  function: callback(bool: result, table: arguments),
  table: arguments
)

--Syntax #2:
local bool: result, table: arguments = self:await(dbify.account.create(
  thread: self,
  string: accountName,
  table: arguments
))

━ dbify.account.delete() (Server)

@Objective: Deletes an existing account.
--Syntax #1:
local bool: state = dbify.account.delete(
  string: accountName,
  function: callback(bool: result, table: arguments),
  table: arguments
)

--Syntax #2:
local bool: result, table: arguments = self:await(dbify.account.delete(
  thread: self,
  string: accountName,
  table: arguments
))

━ dbify.account.setData() (Server)

@Objective: Sets account datas of a valid account.
--Syntax #1:
local bool: state = dbify.account.setData(
  string: accountName,
  table: {
    --These are columns that has to be updated w/ their respective values
    {string: columnName, ~: columnValue},
    ...
  },
  function: callback(bool: result, table: arguments),
  table: arguments
)

--Syntax #2:
local bool: result, table: arguments = self:await(dbify.account.setData(
  thread: self,
  string: accountName,
  table: {
    --These are columns that has to be updated w/ their respective values
    {string: columnName, ~: columnValue},
    ...
  },
  table: arguments
))

━ dbify.account.getData() (Server)

@Objective: Retrieves account datas of a valid account.
--Syntax #1:
local bool: state = dbify.account.getData(
  string: accountName,
  table: {
    --These are columns whose values are to be retrieved
    string: columnName,
    ...
  },
  function: callback(table: result, table: arguments),
  table: arguments
)

--Syntax #2:
local table: result, table: arguments = self:await(dbify.account.getData(
  thread: self,
  string: accountName,
  table: {
    --These are columns whose values are to be retrieved
    string: columnName,
    ...
  },
  table: arguments
))
Clone this wiki locally