1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- SQL driver
---@class Database
---@field execute fun(database: Database, sql: string, parameters: table | nil)
---@field query_one fun(database: Database, sql: string, parameters: table | nil): table | nil
---@field query_all fun(database: Database, sql: string, parameters: table | nil): table | nil
---@field query_pragma_int fun(database: Database, sql: string): number | nil
---@field query_pragma_text fun(database: Database, sql: string): string | nil
---@field close fun(database: Database)
---Some extra connection options for the databases
---@class DatabaseConnectionOptions
---@field max_connections integer?
---@field extensions string[]? -- SQLite only
---@field extensions_with_entrypoint string[][]? -- SQLite only
---@field is_immutable boolean? -- SQLite only
---@field other_options string[][]?
---Opens a new SQL connection using the provided URL and returns a table representing the connection.
---@param database_type "sqlite"|"postgres" The type of database to connect to.
---@param url string The URL of the SQL database to connect to.
---@param connection_options DatabaseConnectionOptions? Max number of connections to the database pool
---@return Database Database that represents the SQL connection.
---@nodiscard
local
return