-
Notifications
You must be signed in to change notification settings - Fork 27
/
postgres.d.tl
37 lines (32 loc) · 1.11 KB
/
postgres.d.tl
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
local record sql
postgres: function():Driver
record Driver
connect:function(Driver,string):Connection
end
record Connection
setautocommit:function(Connection,boolean):boolean
escape: function(Connection,string):string
execute:function(Connection,string):Cursor|number
commit: function(Connection):boolean
rollback: function(Connection):boolean
close:function(Connection):boolean
end
--these 2 enums are to enable a hack that makes it a lot more nicer to work with the cursor
-- see https://github.com/teal-language/teal-types/pull/18#discussion_r518265263
enum Numeric
"n"
end
enum Alpha
"s"
end
record Cursor
close:function(Cursor):boolean
--this is the hack: https://github.com/teal-language/teal-types/pull/18#discussion_r518265263
fetch: function(Numeric): {string}
fetch: function(Alpha): {string:string}
getcolnames:function(Cursor):{string}
getcoltypes:function(Cursor):{string}
numrows:function(Cursor):number
end
end
return sql