forked from sqlc-dev/sqlc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstdlib.go
More file actions
59 lines (56 loc) · 1.17 KB
/
stdlib.go
File metadata and controls
59 lines (56 loc) · 1.17 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package sqlite
import (
"github.com/kyleconroy/sqlc/internal/sql/ast"
"github.com/kyleconroy/sqlc/internal/sql/catalog"
)
// TODO: fill out sqlite functions from:
// https://www.sqlite.org/lang_aggfunc.html
// https://www.sqlite.org/lang_mathfunc.html
// https://www.sqlite.org/lang_corefunc.html
func defaultSchema(name string) *catalog.Schema {
s := &catalog.Schema{Name: name}
s.Funcs = []*catalog.Function{
{
Name: "COUNT",
Args: []*catalog.Argument{},
ReturnType: &ast.TypeName{Name: "bigint"},
},
{
Name: "COUNT",
Args: []*catalog.Argument{
{
Type: &ast.TypeName{Name: "any"},
},
},
ReturnType: &ast.TypeName{Name: "bigint"},
},
{
Name: "SUM",
Args: []*catalog.Argument{
{
Type: &ast.TypeName{Name: "real"},
},
},
ReturnType: &ast.TypeName{Name: "real"},
},
{
Name: "SUM",
Args: []*catalog.Argument{
{
Type: &ast.TypeName{Name: "integer"},
},
},
ReturnType: &ast.TypeName{Name: "integer"},
},
{
Name: "SUM",
Args: []*catalog.Argument{
{
Type: &ast.TypeName{Name: "any"},
},
},
ReturnType: &ast.TypeName{Name: "bigint"},
},
}
return s
}