mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 21:21:29 +00:00
update annotation
This commit is contained in:
parent
e2316c4b9e
commit
3583ad8cc0
@ -488,9 +488,9 @@ func (d *dbBase) InsertValue(q dbQuerier, mi *modelInfo, isMulti bool, names []s
|
|||||||
return id, err
|
return id, err
|
||||||
}
|
}
|
||||||
|
|
||||||
//insert or update a row
|
// InsertOrUpdate a row
|
||||||
//If your primary key or unique column conflict will update
|
// If your primary key or unique column conflict will update
|
||||||
//if no will insert
|
// If no will insert
|
||||||
func (d *dbBase) InsertOrUpdate(q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time.Location, dn string, args ...string) (int64, error) {
|
func (d *dbBase) InsertOrUpdate(q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time.Location, dn string, args ...string) (int64, error) {
|
||||||
iouStr := ""
|
iouStr := ""
|
||||||
mysql := "mysql"
|
mysql := "mysql"
|
||||||
|
@ -209,7 +209,7 @@ func (o *orm) InsertMulti(bulk int, mds interface{}) (int64, error) {
|
|||||||
return cnt, nil
|
return cnt, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//insert or update data to database
|
// InsertOrUpdate data to database
|
||||||
func (o *orm) InsertOrUpdate(md interface{}, colConflitAndArgs ...string) (int64, error) {
|
func (o *orm) InsertOrUpdate(md interface{}, colConflitAndArgs ...string) (int64, error) {
|
||||||
mi, ind := o.getMiInd(md, true)
|
mi, ind := o.getMiInd(md, true)
|
||||||
id, err := o.alias.DbBaser.InsertOrUpdate(o.db, mi, ind, o.alias.TZ, o.alias.DriverName, colConflitAndArgs...)
|
id, err := o.alias.DbBaser.InsertOrUpdate(o.db, mi, ind, o.alias.TZ, o.alias.DriverName, colConflitAndArgs...)
|
||||||
|
@ -53,10 +53,10 @@ type Ormer interface {
|
|||||||
// id, err = Ormer.Insert(user)
|
// id, err = Ormer.Insert(user)
|
||||||
// user must a pointer and Insert will set user's pk field
|
// user must a pointer and Insert will set user's pk field
|
||||||
Insert(interface{}) (int64, error)
|
Insert(interface{}) (int64, error)
|
||||||
//mysql:InsertOrUpdate(model) or InsertOrUpdate(model,"colu=colu+value")
|
// mysql:InsertOrUpdate(model) or InsertOrUpdate(model,"colu=colu+value")
|
||||||
//if colu type is integer : can use(+-*/), string : convert(colu,"value")
|
// if colu type is integer : can use(+-*/), string : convert(colu,"value")
|
||||||
//postgres: InsertOrUpdate(model,"conflictColumnName") or InsertOrUpdate(model,"conflictColumnName","colu=colu+value")
|
// postgres: InsertOrUpdate(model,"conflictColumnName") or InsertOrUpdate(model,"conflictColumnName","colu=colu+value")
|
||||||
//if colu type is integer : can use(+-*/), string : colu || "value"
|
// if colu type is integer : can use(+-*/), string : colu || "value"
|
||||||
InsertOrUpdate(md interface{}, colConflitAndArgs ...string) (int64, error)
|
InsertOrUpdate(md interface{}, colConflitAndArgs ...string) (int64, error)
|
||||||
// insert some models to database
|
// insert some models to database
|
||||||
InsertMulti(bulk int, mds interface{}) (int64, error)
|
InsertMulti(bulk int, mds interface{}) (int64, error)
|
||||||
|
Loading…
Reference in New Issue
Block a user