-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueries.go
55 lines (50 loc) · 1.32 KB
/
queries.go
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
package main
const CreateTableQuery string = `
CREATE TABLE IF NOT EXISTS overtimes (
id INTEGER NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
time_in TEXT NOT NULL,
time_out TEXT NOT NULL,
hours_ot INTEGER NOT NULL,
reason TEXT NOT NULL
);
`
const InsertOvertimeQuery string = `
INSERT INTO overtimes VALUES(NULL, ?, ?, ?, ?, ?)
`
const ViewMonthOvertimeQuery string = `
SELECT * from overtimes
WHERE
time_in BETWEEN DATE('now','start of month')
AND DATE('now', 'start of month', '+1 month', '-1 day')
ORDER BY
time_in ASC,
time_out ASC`
const ViewMonthGetDatThirtyBroOvertimeQuery string = `
SELECT * from overtimes
WHERE
time_in BETWEEN DATE('now','start of month', '-2 day')
AND DATE('now', 'start of month', '+1 month', '-1 day')
ORDER BY
time_in ASC,
time_out ASC`
const ViewMonthOvertimeWithNamesQueryFmt string = `
SELECT * from overtimes
WHERE
time_in BETWEEN DATE('now','start of month') AND DATE('now', 'start of month', '+1 month', '-1 day')
AND name IN (%s)
ORDER BY
time_in ASC,
time_out ASC,
name ASC
`
const ViewMonthGetDatThirtyBroOvertimeQueryFmt string = `
SELECT * from overtimes
WHERE
time_in BETWEEN DATE('now','start of month', '-2 day') AND DATE('now', 'start of month', '+1 month', '-1 day')
AND name IN (%s)
ORDER BY
time_in ASC,
time_out ASC,
name ASC
`