File tree Expand file tree Collapse file tree 4 files changed +7
-5
lines changed Expand file tree Collapse file tree 4 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ func (i *importer) dbImports() fileImports {
124
124
}
125
125
std := []ImportSpec {
126
126
{Path : "runtime" },
127
+ {Path : "context" },
127
128
}
128
129
129
130
sqlpkg := parseDriver (i .Options .SqlPackage )
Original file line number Diff line number Diff line change @@ -308,7 +308,7 @@ func (q *Query) ReceiverType() string {
308
308
if q .IsReadOnly () {
309
309
return "Queries"
310
310
}
311
- return "WriteTx "
311
+ return "WriteTxn "
312
312
}
313
313
314
314
func (q * Query ) hasRetType () bool {
Original file line number Diff line number Diff line change 1
1
{{define "dbCodeTemplateStd"}}
2
2
3
3
type Queries struct {
4
+ Ctx context.Context
4
5
conn *sqlite.Conn
5
6
pin runtime.Pinner
6
7
{{- range .ReadQueries }}
7
8
{{.FieldName}} {{.MethodName}}Stmt
8
9
{{- end}}
9
10
}
10
11
11
- type WriteTx struct {
12
+ type WriteTxn struct {
12
13
Queries
13
14
finish func(*error)
14
15
{{- range .WriteQueries }}
@@ -40,7 +41,7 @@ func (q *Queries) Close() *lib.Error {
40
41
return firstErr
41
42
}
42
43
43
- func (txn *WriteTx ) Close() *lib.Error {
44
+ func (txn *WriteTxn ) Close() *lib.Error {
44
45
var err, firstErr *lib.Error
45
46
{{- range .WriteQueries }}
46
47
txn.{{.FieldName}}.Close()
Original file line number Diff line number Diff line change @@ -95,9 +95,9 @@ func (q *{{ .ReceiverType }}) {{.MethodName}}({{ .Arg.Pair }}) (result {{.Ret.De
95
95
return
96
96
}
97
97
if !ok {
98
- err = ErrNoRows
98
+ err = errNoRows
99
99
} else if r.Next() {
100
- err = ErrTooManyRows
100
+ err = errTooManyRows
101
101
} else {
102
102
result = r.Row
103
103
}
You can’t perform that action at this time.
0 commit comments