-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_interface.go
52 lines (51 loc) · 1.82 KB
/
db_interface.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
package frame
// 数据库接口
type Db interface {
Select(field ...interface{}) Db
SelectCount(field string, alias ...string) Db
Join(table string, condition string, alias ...string) Db
LeftJoin(table string, condition string, alias ...string) Db
RightJoin(table string, condition string, alias ...string) Db
Insert(table string, info map[string]interface{}) Db
InsertBatch(table string, data []map[string]interface{}, onceMaxCounts ...int) Db
Update(table string, info map[string]interface{}) Db
Replace(table string, info map[string]interface{}) Db
ReplaceBatch(table string, data []map[string]interface{}, onceMaxCounts ...int) Db
Delete(table string) Db
Sql(preSql string, params ...interface{}) Db
From(table string, alias ...string) Db
Distinct() Db
Ignore() Db
ForceMaster() Db
Where(field string, value interface{}, ops ...string) Db
MultiWhere(conditions map[string]interface{}) Db
OrWhere(field string, value interface{}, ops ...string) Db
MultiOrWhere(conditions map[string]interface{}) Db
WhereSql(whereSql string, params ...interface{}) Db
Having(field string, value interface{}, ops ...string) Db
MultiHaving(conditions map[string]interface{}) Db
OrHaving(field string, value interface{}, ops ...string) Db
MultiOrHaving(conditions map[string]interface{}) Db
HavingSql(havingSql string, params ...interface{}) Db
BeginWhereGroup() Db
BeginOrWhereGroup() Db
EndWhereGroup() Db
BeginHavingGroup() Db
BeginOrHavingGroup() Db
EndHavingGroup() Db
GroupBy(field interface{}) Db
OrderBy(field string) Db
Limit(count int) Db
OffSet(count int) Db
Page(count int) Db
Count(count int) Db
GetSql() interface{}
Exec() (int, bool)
Fetch(interface{}) (interface{}, error)
FetchAll(interface{}) ([]interface{}, error)
AffectedRows() int
GetLastInsertId() int
BeginTrans() bool
CommitTrans() bool
RollbackTrans() bool
}