/
game.sql.go
129 lines (107 loc) · 3.49 KB
/
game.sql.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// Code generated by qtc from "game.sql". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
package game
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
func streamqryGameInsert(qw422016 *qt422016.Writer) {
qw422016.N().S(`INSERT INTO games ( id, type, updatedOn, isActive, serialized ) VALUES ( ?, ?, ?, 1, ? ) `)
}
func writeqryGameInsert(qq422016 qtio422016.Writer) {
qw422016 := qt422016.AcquireWriter(qq422016)
streamqryGameInsert(qw422016)
qt422016.ReleaseWriter(qw422016)
}
func qryGameInsert() string {
qb422016 := qt422016.AcquireByteBuffer()
writeqryGameInsert(qb422016)
qs422016 := string(qb422016.B)
qt422016.ReleaseByteBuffer(qb422016)
return qs422016
}
func streamqryGameUpdate(qw422016 *qt422016.Writer) {
qw422016.N().S(`UPDATE games Set updatedOn=?, isActive=?, serialized=? WHERE id=? AND type=? `)
}
func writeqryGameUpdate(qq422016 qtio422016.Writer) {
qw422016 := qt422016.AcquireWriter(qq422016)
streamqryGameUpdate(qw422016)
qt422016.ReleaseWriter(qw422016)
}
func qryGameUpdate() string {
qb422016 := qt422016.AcquireByteBuffer()
writeqryGameUpdate(qb422016)
qs422016 := string(qb422016.B)
qt422016.ReleaseByteBuffer(qb422016)
return qs422016
}
func streamqryGameGet(qw422016 *qt422016.Writer, forUpdate bool) {
qw422016.N().S(`SELECT type, serialized FROM games WHERE id=? `)
if forUpdate {
qw422016.N().S(`FOR UPDATE `)
}
}
func writeqryGameGet(qq422016 qtio422016.Writer, forUpdate bool) {
qw422016 := qt422016.AcquireWriter(qq422016)
streamqryGameGet(qw422016, forUpdate)
qt422016.ReleaseWriter(qw422016)
}
func qryGameGet(forUpdate bool) string {
qb422016 := qt422016.AcquireByteBuffer()
writeqryGameGet(qb422016, forUpdate)
qs422016 := string(qb422016.B)
qt422016.ReleaseByteBuffer(qb422016)
return qs422016
}
func streamqryGameGetActive(qw422016 *qt422016.Writer, forUpdate bool) {
qw422016.N().S(`SELECT g.type, g.serialized FROM games g INNER JOIN players p ON p.game=g.id WHERE p.id=? AND g.isActive=1 `)
if forUpdate {
qw422016.N().S(`FOR UPDATE `)
}
}
func writeqryGameGetActive(qq422016 qtio422016.Writer, forUpdate bool) {
qw422016 := qt422016.AcquireWriter(qq422016)
streamqryGameGetActive(qw422016, forUpdate)
qt422016.ReleaseWriter(qw422016)
}
func qryGameGetActive(forUpdate bool) string {
qb422016 := qt422016.AcquireByteBuffer()
writeqryGameGetActive(qb422016, forUpdate)
qs422016 := string(qb422016.B)
qt422016.ReleaseByteBuffer(qb422016)
return qs422016
}
func streamqryGameDeleteExpired(qw422016 *qt422016.Writer) {
qw422016.N().S(`DELETE FROM games WHERE updatedOn<? `)
}
func writeqryGameDeleteExpired(qq422016 qtio422016.Writer) {
qw422016 := qt422016.AcquireWriter(qq422016)
streamqryGameDeleteExpired(qw422016)
qt422016.ReleaseWriter(qw422016)
}
func qryGameDeleteExpired() string {
qb422016 := qt422016.AcquireByteBuffer()
writeqryGameDeleteExpired(qb422016)
qs422016 := string(qb422016.B)
qt422016.ReleaseByteBuffer(qb422016)
return qs422016
}
func streamqryPlayerInsert(qw422016 *qt422016.Writer) {
qw422016.N().S(`INSERT INTO players ( id, game ) VALUES ( ?, ? ) `)
}
func writeqryPlayerInsert(qq422016 qtio422016.Writer) {
qw422016 := qt422016.AcquireWriter(qq422016)
streamqryPlayerInsert(qw422016)
qt422016.ReleaseWriter(qw422016)
}
func qryPlayerInsert() string {
qb422016 := qt422016.AcquireByteBuffer()
writeqryPlayerInsert(qb422016)
qs422016 := string(qb422016.B)
qt422016.ReleaseByteBuffer(qb422016)
return qs422016
}