-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsql.go
44 lines (40 loc) · 1003 Bytes
/
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
package sql
import (
"bytes"
"database/sql"
)
type SQL interface {
initialize() SQL
Conn() *sql.DB
Table(tableName string) Table
clear()
}
type Table interface {
Select(fields string) Table
Where(where string, argc ...interface{}) Table
WhereOr(where string, argc ...interface{}) Table
Sort(filed string, sortBy string) Query
Offset(offset int64) Query
Limit(limit int64) Query
Group(group string) Query
Find(dest interface{}) error
Count(count *int64) error
Sum(sum *int64) error
Avg(avg *int64) error
Update(dest interface{}) error
Save(dest interface{}) error
Delete() error
SetInc(field string) error // feature:field value + 1
SetDec(field string) error // feature:field value - 1
parseSQL(op interface{}) bytes.Buffer
}
type Query interface {
Sort(filed string, sortBy string) Query
Offset(offset int64) Query
Limit(limit int64) Query
Group(group string) Query
Find(dest interface{}) error
Count(count *int64) error
Sum(sum *int64) error
Avg(avg *int64) error
}