mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 09:10:55 +00:00
orm add Exist func
This commit is contained in:
parent
3f91dfbca3
commit
5d55ca19be
@ -114,6 +114,11 @@ func (o *querySet) Count() (int64, error) {
|
|||||||
return o.orm.alias.DbBaser.Count(o.orm.db, o, o.mi, o.cond, o.orm.alias.TZ)
|
return o.orm.alias.DbBaser.Count(o.orm.db, o, o.mi, o.cond, o.orm.alias.TZ)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *querySet) Exist() bool {
|
||||||
|
cnt, _ := o.orm.alias.DbBaser.Count(o.orm.db, o, o.mi, o.cond, o.orm.alias.TZ)
|
||||||
|
return cnt > 0
|
||||||
|
}
|
||||||
|
|
||||||
func (o *querySet) Update(values Params) (int64, error) {
|
func (o *querySet) Update(values Params) (int64, error) {
|
||||||
return o.orm.alias.DbBaser.UpdateBatch(o.orm.db, o, o.mi, o.cond, values, o.orm.alias.TZ)
|
return o.orm.alias.DbBaser.UpdateBatch(o.orm.db, o, o.mi, o.cond, values, o.orm.alias.TZ)
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ type QuerySeter interface {
|
|||||||
OrderBy(...string) QuerySeter
|
OrderBy(...string) QuerySeter
|
||||||
RelatedSel(...interface{}) QuerySeter
|
RelatedSel(...interface{}) QuerySeter
|
||||||
Count() (int64, error)
|
Count() (int64, error)
|
||||||
|
Exist() bool
|
||||||
Update(Params) (int64, error)
|
Update(Params) (int64, error)
|
||||||
Delete() (int64, error)
|
Delete() (int64, error)
|
||||||
PrepareInsert() (Inserter, error)
|
PrepareInsert() (Inserter, error)
|
||||||
|
Loading…
Reference in New Issue
Block a user