From 3583ad8cc0784cf208ccce1272440f004e60cf5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cfudali113=E2=80=9D?= <“fudali113@gmail.com”> Date: Thu, 21 Jul 2016 15:49:55 +0800 Subject: [PATCH] update annotation --- orm/db.go | 6 +++--- orm/orm.go | 2 +- orm/types.go | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/orm/db.go b/orm/db.go index 871f4a5d..40e71d12 100644 --- a/orm/db.go +++ b/orm/db.go @@ -488,9 +488,9 @@ func (d *dbBase) InsertValue(q dbQuerier, mi *modelInfo, isMulti bool, names []s return id, err } -//insert or update a row -//If your primary key or unique column conflict will update -//if no will insert +// InsertOrUpdate a row +// If your primary key or unique column conflict will update +// If no will insert func (d *dbBase) InsertOrUpdate(q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time.Location, dn string, args ...string) (int64, error) { iouStr := "" mysql := "mysql" diff --git a/orm/orm.go b/orm/orm.go index fe189037..c84dddea 100644 --- a/orm/orm.go +++ b/orm/orm.go @@ -209,7 +209,7 @@ func (o *orm) InsertMulti(bulk int, mds interface{}) (int64, error) { return cnt, nil } -//insert or update data to database +// InsertOrUpdate data to database func (o *orm) InsertOrUpdate(md interface{}, colConflitAndArgs ...string) (int64, error) { mi, ind := o.getMiInd(md, true) id, err := o.alias.DbBaser.InsertOrUpdate(o.db, mi, ind, o.alias.TZ, o.alias.DriverName, colConflitAndArgs...) diff --git a/orm/types.go b/orm/types.go index 7864e315..b375fd65 100644 --- a/orm/types.go +++ b/orm/types.go @@ -53,10 +53,10 @@ type Ormer interface { // id, err = Ormer.Insert(user) // user must a pointer and Insert will set user's pk field Insert(interface{}) (int64, error) - //mysql:InsertOrUpdate(model) or InsertOrUpdate(model,"colu=colu+value") - //if colu type is integer : can use(+-*/), string : convert(colu,"value") - //postgres: InsertOrUpdate(model,"conflictColumnName") or InsertOrUpdate(model,"conflictColumnName","colu=colu+value") - //if colu type is integer : can use(+-*/), string : colu || "value" + // mysql:InsertOrUpdate(model) or InsertOrUpdate(model,"colu=colu+value") + // if colu type is integer : can use(+-*/), string : convert(colu,"value") + // postgres: InsertOrUpdate(model,"conflictColumnName") or InsertOrUpdate(model,"conflictColumnName","colu=colu+value") + // if colu type is integer : can use(+-*/), string : colu || "value" InsertOrUpdate(md interface{}, colConflitAndArgs ...string) (int64, error) // insert some models to database InsertMulti(bulk int, mds interface{}) (int64, error)