The database section currently only covers one server side function, this will be added too as time progresses.



Generates a unique ID by concatenating a prefix with a randomly generated string. Checks the uniqueness of the ID in the specified database table and column or if a JSON path is provided, it checks within the JSON structure in the specified column. This is particularly useful for things like unique passport ID's, licence ID's etc.

--- Utils object
utils.db.generate_unique_id(prefix, length, table_name, column_name, json_path)

--- Export
exports.boii_utils:db_generate_unique_id(prefix, length, table_name, column_name, json_path)
local order_no = utils.db.generate_unique_id('ORDER_', 5, 'stores', 'orders', '$.order_no')

if order_no then print(order_no) end

Last updated