1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-16 02:22:15 +00:00

orm support complete m2m operation api / auto load related api

This commit is contained in:
slene
2013-10-14 22:31:35 +08:00
parent e11c40eee4
commit d043ebcdd3
11 changed files with 850 additions and 234 deletions

View File

@@ -24,9 +24,8 @@ type Ormer interface {
Insert(interface{}) (int64, error)
Update(interface{}, ...string) (int64, error)
Delete(interface{}) (int64, error)
M2mAdd(interface{}, string, ...interface{}) (int64, error)
M2mDel(interface{}, string, ...interface{}) (int64, error)
LoadRel(interface{}, string) (int64, error)
LoadRelated(interface{}, string, ...interface{}) (int64, error)
QueryM2M(interface{}, string) QueryM2Mer
QueryTable(interface{}) QuerySeter
Using(string) error
Begin() error
@@ -61,6 +60,14 @@ type QuerySeter interface {
ValuesFlat(*ParamsList, string) (int64, error)
}
type QueryM2Mer interface {
Add(...interface{}) (int64, error)
Remove(...interface{}) (int64, error)
Exist(interface{}) bool
Clear() (int64, error)
Count() (int64, error)
}
type RawPreparer interface {
Exec(...interface{}) (sql.Result, error)
Close() error
@@ -114,6 +121,7 @@ type txEnder interface {
type dbBaser interface {
Read(dbQuerier, *modelInfo, reflect.Value, *time.Location, []string) error
Insert(dbQuerier, *modelInfo, reflect.Value, *time.Location) (int64, error)
InsertValue(dbQuerier, *modelInfo, []string, []interface{}) (int64, error)
InsertStmt(stmtQuerier, *modelInfo, reflect.Value, *time.Location) (int64, error)
Update(dbQuerier, *modelInfo, reflect.Value, *time.Location, []string) (int64, error)
Delete(dbQuerier, *modelInfo, reflect.Value, *time.Location) (int64, error)
@@ -139,4 +147,5 @@ type dbBaser interface {
ShowTablesQuery() string
ShowColumnsQuery(string) string
IndexExists(dbQuerier, string, string) bool
collectFieldValue(*modelInfo, *fieldInfo, reflect.Value, bool, *time.Location) (interface{}, error)
}