-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbinterface.go
More file actions
38 lines (33 loc) · 873 Bytes
/
dbinterface.go
File metadata and controls
38 lines (33 loc) · 873 Bytes
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
package gocockroachdb
// DbRow database row
type DbRow struct {
Columns []string
Row []string
}
// DbRows array of database rows
type DbRows struct {
Columns []string
Rows [][]string
}
// Database Database
type Database interface {
Connect() bool
BeginTransaction() Transaction
Test(query string, args ...any) *DbRow
Insert(query string, args ...any) (bool, int64)
Update(query string, args ...any) bool
Get(query string, args ...any) *DbRow
GetList(query string, args ...any) *DbRows
Delete(query string, args ...any) bool
Exec(query string) (bool, error)
Close() bool
}
// Transaction transaction
type Transaction interface {
Insert(query string, args ...any) (bool, int64)
Update(query string, args ...any) bool
Delete(query string, args ...any) bool
Commit() bool
Rollback() bool
}
// go mod init github.com/GolangToolKits/go-cockroachdb