62 Star 374 Fork 119

admpub / nging

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
TaskLog.go 3.62 KB
一键复制 编辑 原始数据 按行查看 历史
admpub 提交于 2017-04-06 11:17 . 增加定时任务和用户表
//Do not edit this file, which is automatically generated by the generator.
package dbschema
import (
"github.com/webx-top/db"
"github.com/webx-top/db/lib/factory"
"time"
)
type TaskLog struct {
param *factory.Param
trans *factory.Transaction
objects []*TaskLog
Id uint `db:"id,omitempty,pk" bson:"id,omitempty" comment:"" json:"id" xml:"id"`
TaskId uint `db:"task_id" bson:"task_id" comment:"任务ID" json:"task_id" xml:"task_id"`
Output string `db:"output" bson:"output" comment:"任务输出" json:"output" xml:"output"`
Error string `db:"error" bson:"error" comment:"错误信息" json:"error" xml:"error"`
Status string `db:"status" bson:"status" comment:"状态" json:"status" xml:"status"`
Elapsed uint `db:"elapsed" bson:"elapsed" comment:"消耗时间(毫秒)" json:"elapsed" xml:"elapsed"`
Created uint `db:"created" bson:"created" comment:"创建时间" json:"created" xml:"created"`
}
func (this *TaskLog) Trans() *factory.Transaction {
return this.trans
}
func (this *TaskLog) Use(trans *factory.Transaction) factory.Model {
this.trans = trans
return this
}
func (this *TaskLog) Objects() []*TaskLog {
if this.objects == nil {
return nil
}
return this.objects[:]
}
func (this *TaskLog) NewObjects() *[]*TaskLog {
this.objects = []*TaskLog{}
return &this.objects
}
func (this *TaskLog) NewParam() *factory.Param {
return factory.NewParam(factory.DefaultFactory).SetTrans(this.trans).SetCollection("task_log").SetModel(this)
}
func (this *TaskLog) SetParam(param *factory.Param) factory.Model {
this.param = param
return this
}
func (this *TaskLog) Param() *factory.Param {
if this.param == nil {
return this.NewParam()
}
return this.param
}
func (this *TaskLog) Get(mw func(db.Result) db.Result, args ...interface{}) error {
return this.Param().SetArgs(args...).SetRecv(this).SetMiddleware(mw).One()
}
func (this *TaskLog) List(recv interface{}, mw func(db.Result) db.Result, page, size int, args ...interface{}) (func() int64, error) {
if recv == nil {
recv = this.NewObjects()
}
return this.Param().SetArgs(args...).SetPage(page).SetSize(size).SetRecv(recv).SetMiddleware(mw).List()
}
func (this *TaskLog) ListByOffset(recv interface{}, mw func(db.Result) db.Result, offset, size int, args ...interface{}) (func() int64, error) {
if recv == nil {
recv = this.NewObjects()
}
return this.Param().SetArgs(args...).SetOffset(offset).SetSize(size).SetRecv(recv).SetMiddleware(mw).List()
}
func (this *TaskLog) Add() (pk interface{}, err error) {
this.Created = uint(time.Now().Unix())
this.Id = 0
pk, err = this.Param().SetSend(this).Insert()
if err == nil && pk != nil {
if v, y := pk.(uint); y {
this.Id = v
} else if v, y := pk.(int64); y {
this.Id = uint(v)
}
}
return
}
func (this *TaskLog) Edit(mw func(db.Result) db.Result, args ...interface{}) error {
return this.Param().SetArgs(args...).SetSend(this).SetMiddleware(mw).Update()
}
func (this *TaskLog) Upsert(mw func(db.Result) db.Result, args ...interface{}) (pk interface{}, err error) {
pk, err = this.Param().SetArgs(args...).SetSend(this).SetMiddleware(mw).Upsert(func(){
},func(){
this.Created = uint(time.Now().Unix())
this.Id = 0
})
if err == nil && pk != nil {
if v, y := pk.(uint); y {
this.Id = v
} else if v, y := pk.(int64); y {
this.Id = uint(v)
}
}
return
}
func (this *TaskLog) Delete(mw func(db.Result) db.Result, args ...interface{}) error {
return this.Param().SetArgs(args...).SetMiddleware(mw).Delete()
}
func (this *TaskLog) Count(mw func(db.Result) db.Result, args ...interface{}) (int64, error) {
return this.Param().SetArgs(args...).SetMiddleware(mw).Count()
}
Go
1
https://gitee.com/admpub/nging.git
git@gitee.com:admpub/nging.git
admpub
nging
nging
v1.3.0

搜索帮助