-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.lua
More file actions
13 lines (12 loc) · 1.81 KB
/
Copy pathtypes.lua
File metadata and controls
13 lines (12 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
---@class TransactionStep
---@field query string | number
---@field values any[]
---@class MnrSql
---@field query fun(query: string | number, params?: any[]): table[] | nil, number | nil Executes a SELECT and returns all rows.
---@field single fun(query: string | number, params?: any[]): table | nil, number | nil Executes a SELECT and returns the first row.
---@field scalar fun(query: string | number, params?: any[]): any | nil, number | nil Executes a SELECT and returns the value of the first column of the first row.
---@field insert fun(query: string | number, params?: any[]): number | nil, number | nil Executes an INSERT and returns the generated auto-increment ID.
---@field update fun(query: string | number, params?: any[]): number | nil, number | nil Executes an UPDATE or DELETE and returns the affected row count.
---@field prepare fun(query: string | number, params: any[] | any[][]): table[] | { insertId: number, affectedRows: number } | nil, number | nil Executes one query with a single or a batch of parameter sets; returns rows for a SELECT, `{ insertId, affectedRows }` for a mutation, or an array of either when `params` is a batch.
---@field transaction fun(steps: TransactionStep[]): boolean, number | nil Executes all steps in a single transaction.
---@field store fun(query: string): number Stores a SQL query and returns its numeric handle.