forked from alash3al/sqler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.github.hcl
39 lines (33 loc) · 1.06 KB
/
config.github.hcl
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
// create a macro/endpoint called "_boot",
// this macro is private "used within other macros"
// because it starts with "_".
_boot {
// the query we want to execute
exec = <<SQL
IF NOT EXISTS (select * from sysobjects where name='github' and xtype='U')
CREATE TABLE IF NOT EXISTS [dbo].[github](
[GITHUB_USER] [varchar](max) NOT NULL,
[GITHUB_TOKEN] [varchar](max) NOT NULL,
[GITHUB_REPO] [varchar](max) NOT NULL,
[GITHUB_PROJ] [varchar](max) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
SQL
}
// adduser macro/endpoint, just hit `/adduser` with
// a `?user_name=&user_email=` or json `POST` request
// with the same fields.
getgithubuser {
//validators {
// botid_is_not_empty = "$input.botid && $input.botid.trim().length > 0"
//}
bind {
projectname = "$input.projectname"
}
methods = ["POST"]
//methods = ["GET"]
// include some macros we declared before
// include = ["_boot"]
exec = <<SQL
SELECT * FROM github WHERE GITHUB_PROJ=:projectname;
SQL
}