1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-23 19:20:49 +00:00
Beego/orm/types.go

126 lines
3.3 KiB
Go
Raw Normal View History

2013-07-30 12:32:38 +00:00
package orm
import (
"database/sql"
"reflect"
)
2013-08-07 11:11:44 +00:00
type Driver interface {
Name() string
Type() DriverType
}
2013-07-30 12:32:38 +00:00
type Fielder interface {
String() string
FieldType() int
SetRaw(interface{}) error
RawValue() interface{}
2013-07-31 14:11:22 +00:00
Clean() error
2013-07-30 12:32:38 +00:00
}
type Ormer interface {
Read(interface{}) error
Insert(interface{}) (int64, error)
Update(interface{}) (int64, error)
Delete(interface{}) (int64, error)
M2mAdd(interface{}, string, ...interface{}) (int64, error)
M2mDel(interface{}, string, ...interface{}) (int64, error)
LoadRel(interface{}, string) (int64, error)
2013-07-30 12:32:38 +00:00
QueryTable(interface{}) QuerySeter
Using(string) error
Begin() error
Commit() error
Rollback() error
Raw(string, ...interface{}) RawSeter
2013-08-07 11:11:44 +00:00
Driver() Driver
2013-07-30 12:32:38 +00:00
}
type Inserter interface {
Insert(interface{}) (int64, error)
2013-07-30 12:32:38 +00:00
Close() error
}
type QuerySeter interface {
Filter(string, ...interface{}) QuerySeter
Exclude(string, ...interface{}) QuerySeter
2013-08-07 11:11:44 +00:00
SetCond(*Condition) QuerySeter
2013-07-30 12:32:38 +00:00
Limit(int, ...int64) QuerySeter
Offset(int64) QuerySeter
OrderBy(...string) QuerySeter
RelatedSel(...interface{}) QuerySeter
Count() (int64, error)
Update(Params) (int64, error)
Delete() (int64, error)
PrepareInsert() (Inserter, error)
All(interface{}) (int64, error)
One(interface{}) error
2013-07-30 12:32:38 +00:00
Values(*[]Params, ...string) (int64, error)
ValuesList(*[]ParamsList, ...string) (int64, error)
ValuesFlat(*ParamsList, string) (int64, error)
}
type RawPreparer interface {
2013-08-07 11:11:44 +00:00
Exec(...interface{}) (int64, error)
2013-07-30 12:32:38 +00:00
Close() error
}
type RawSeter interface {
Exec() (int64, error)
2013-08-07 11:11:44 +00:00
QueryRow(...interface{}) error
QueryRows(...interface{}) (int64, error)
SetArgs(...interface{}) RawSeter
2013-07-30 12:32:38 +00:00
Values(*[]Params) (int64, error)
ValuesList(*[]ParamsList) (int64, error)
ValuesFlat(*ParamsList) (int64, error)
Prepare() (RawPreparer, error)
}
2013-07-31 14:11:22 +00:00
type IFieldError interface {
Name() string
Error() error
}
type IFieldErrors interface {
Get(string) IFieldError
Set(string, IFieldError)
List() []IFieldError
}
2013-08-09 05:20:19 +00:00
type stmtQuerier interface {
Close() error
Exec(args ...interface{}) (sql.Result, error)
Query(args ...interface{}) (*sql.Rows, error)
QueryRow(args ...interface{}) *sql.Row
}
2013-07-30 12:32:38 +00:00
type dbQuerier interface {
Prepare(query string) (*sql.Stmt, error)
Exec(query string, args ...interface{}) (sql.Result, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
QueryRow(query string, args ...interface{}) *sql.Row
}
2013-08-09 05:20:19 +00:00
type txer interface {
Begin() (*sql.Tx, error)
}
type txEnder interface {
Commit() error
Rollback() error
}
2013-07-30 12:32:38 +00:00
type dbBaser interface {
2013-08-01 07:51:53 +00:00
Read(dbQuerier, *modelInfo, reflect.Value) error
2013-07-30 12:32:38 +00:00
Insert(dbQuerier, *modelInfo, reflect.Value) (int64, error)
2013-08-09 05:20:19 +00:00
InsertStmt(stmtQuerier, *modelInfo, reflect.Value) (int64, error)
2013-07-30 12:32:38 +00:00
Update(dbQuerier, *modelInfo, reflect.Value) (int64, error)
Delete(dbQuerier, *modelInfo, reflect.Value) (int64, error)
ReadBatch(dbQuerier, *querySet, *modelInfo, *Condition, interface{}) (int64, error)
UpdateBatch(dbQuerier, *querySet, *modelInfo, *Condition, Params) (int64, error)
DeleteBatch(dbQuerier, *querySet, *modelInfo, *Condition) (int64, error)
Count(dbQuerier, *querySet, *modelInfo, *Condition) (int64, error)
GetOperatorSql(*modelInfo, string, []interface{}) (string, []interface{})
2013-08-09 05:20:19 +00:00
PrepareInsert(dbQuerier, *modelInfo) (stmtQuerier, string, error)
2013-07-30 12:32:38 +00:00
ReadValues(dbQuerier, *querySet, *modelInfo, *Condition, []string, interface{}) (int64, error)
}