-
Notifications
You must be signed in to change notification settings - Fork 4
/
sqldb.go
106 lines (89 loc) · 3.71 KB
/
sqldb.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
// Package sqldb provides Encore services direct access to their databases.
//
// For the documentation on how to use databases within Encore see https://encore.dev/docs/develop/databases.
package sqldb
import (
"context"
"database/sql"
)
// ErrNoRows is an error reported by Scan when QueryRow doesn't return a row.
// It must be tested against with errors.Is.
var ErrNoRows = sql.ErrNoRows
// ExecResult is the result of an Exec query.
type ExecResult interface {
// RowsAffected returns the number of rows affected. If the result was not
// for a row affecting command (e.g. "CREATE TABLE") then it returns 0.
RowsAffected() int64
}
// Tx is a handle to a database transaction.
//
// See *database/sql.Tx for additional documentation.
type Tx struct {
_ int // for godoc to show unexported fields
}
// Commit commits the given transaction.
//
// See (*database/sql.Tx).Commit() for additional documentation.
func (*Tx) Commit() error { panic("encore apps must be run using the encore command") }
// Rollback rolls back the given transaction.
//
// See (*database/sql.Tx).Rollback() for additional documentation.
func (*Tx) Rollback() error { panic("encore apps must be run using the encore command") }
func (*Tx) Exec(ctx context.Context, query string, args ...interface{}) (ExecResult, error) {
panic("encore apps must be run using the encore command")
}
func (*Tx) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error) {
panic("encore apps must be run using the encore command")
}
func (*Tx) QueryRow(ctx context.Context, query string, args ...interface{}) *Row {
panic("encore apps must be run using the encore command")
}
// Rows is the result of a query. Its cursor starts before the first row
// of the result set. Use Next to advance from row to row.
//
// See *database/sql.Rows for additional documentation.
type Rows struct {
_ int // for godoc to show unexported fields
}
// Close closes the Rows, preventing further enumeration.
//
// See (*database/sql.Rows).Close() for additional documentation.
func (*Rows) Close() { panic("encore apps must be run using the encore command") }
// Scan copies the columns in the current row into the values pointed
// at by dest. The number of values in dest must be the same as the
// number of columns in Rows.
//
// See (*database/sql.Rows).Scan() for additional documentation.
func (*Rows) Scan(dest ...interface{}) error {
panic("encore apps must be run using the encore command")
}
// Err returns the error, if any, that was encountered during iteration.
// Err may be called after an explicit or implicit Close.
//
// See (*database/sql.Rows).Err() for additional documentation.
func (*Rows) Err() error { panic("encore apps must be run using the encore command") }
// Next prepares the next result row for reading with the Scan method. It
// returns true on success, or false if there is no next result row or an error
// happened while preparing it. Err should be consulted to distinguish between
// the two cases.
//
// Every call to Scan, even the first one, must be preceded by a call to Next.
//
// See (*database/sql.Rows).Next() for additional documentation.
func (*Rows) Next() bool { panic("encore apps must be run using the encore command") }
// Row is the result of calling QueryRow to select a single row.
//
// See *database/sql.Row for additional documentation.
type Row struct {
_ int // for godoc to show unexported fields
}
// Scan copies the columns from the matched row into the values
// pointed at by dest.
//
// See (*database/sql.Row).Scan() for additional documentation.
func (*Row) Scan(dest ...interface{}) error {
panic("encore apps must be run using the encore command")
}
func (*Row) Err() error {
panic("encore apps must be run using the encore command")
}