Class Server.DBSC

Fields

__meta: Server.DBSC.Meta
Visibility: private
__cache: table<string, Server.DBSC>
Visibility: private
cached objects

Methods

new(meta: Server.DBSC.Meta): Server.DBSC
Note: @nodiscard - Return value should not be ignored
Creates a new class extending the DBSC class.
Parameters:
Returns: class a new class extending the DBSC class
primaryKey(): Server.DBSC.Meta.Column?
Returns the column that is the primary key of this table.
Returns: column the primary key column or nil if not found
init()
Initializes the DBSC subclass.
insert(): boolean
Note: @nodiscard - Return value should not be ignored
Inserts the object into the database.
Returns: success whether the insert was successful
update(): boolean
Note: @nodiscard - Return value should not be ignored
Updates the object in the database.
Returns: success whether the update was successful
get(primary_keys: table<string, any>): Server.DBSC?
Loads an object by its primary keys
Parameters:
  • primary_keys (table<string, any>): the values of the primary keys
Returns: object The loaded object or nil if not found
getWhere(conditions: table<string, any>): table<Server.DBSC>
Note: @nodiscard - Return value should not be ignored
Returns a list of objects matching the given conditions.
Parameters:
  • conditions (table<string, any>): the conditions to match
Returns: instances a list of matching objects
delete(): boolean
Note: @nodiscard - Return value should not be ignored
Deletes the object from the database.
Returns: success whether the delete was successful