// ========================================================================== // This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY. // ========================================================================== package internal import ( "context" "dashoo.cn/opms_parent/app/model/opsdev" "database/sql" "github.com/gogf/gf/database/gdb" "github.com/gogf/gf/frame/g" "github.com/gogf/gf/frame/gmvc" "time" ) // OpsOperationEventDao is the manager for logic model data accessing // and custom defined data operations functions management. type OpsOperationEventDao struct { gmvc.M DB gdb.DB Table string Columns opsOperationEventColumns } // OpsOperationEventColumns defines and stores column names for table ops_operation_event. type opsOperationEventColumns struct { Id string // 主键 EventNo string // 事件编号 EventTitle string // 事件标题 EventDesc string // 事件描述 EventType string // 事件类型:10-操作咨询 20-数据处理 30-系统BUG 40-功能调整 50-二开需求 90-其他问题 EventStatus string // 事件状态:10-待处理 20-处理中 30-转研发 70-挂起 80-已关闭 EventResult string // 事件结果:10-已解决 20-部分解决 30-未解决 ContractId string // 关联合同ID ContractName string // 合同名称 CustId string // 关联客户ID CustName string // 客户名称 ProductLine string // 产品线:10-Biobank 20-LIMS 30-CellLbank IsBig string // 是否重点项目:10-是 20-否 IsOps string // 是否在运维期:10-是 20-否 PriorityLevel string // 优先级:P1-紧急 P2-一般 P3-低优 FeedbackSource string // 反馈来源:10-客户 20-销售 30-交付 FeedbackReporter string // 反馈人 FeedbackDate string // 反馈时间 OpsUserId string // 运维人员ID OpsUserName string // 运维人员姓名 AssignTime string // 接单时间 CompleteTime string // 处理完成时间 CompleteDesc string // 处理结果说明 Attribute1 string // 增强字段1 Attribute2 string // 增强字段2 Attribute3 string // 增强字段3 Attribute4 string // 增强字段4 Attribute5 string // 增强字段5 Attribute6 string // 增强字段6 Attribute7 string // 增强字段7 Attribute8 string // 增强字段8 Attribute9 string // 增强字段9 Remark string // 备注 CreatedBy string // 创建者ID CreatedName string // 创建人姓名 CreatedTime string // 创建时间 UpdatedBy string // 更新者ID UpdatedName string // 更新人姓名 UpdatedTime string // 更新时间 DeletedTime string // 删除时间(NULL=未删除) } var ( // OpsOperationEvent is globally public accessible object for table ops_operation_event operations. OpsOperationEvent = OpsOperationEventDao{ M: g.DB("default").Model("ops_operation_event").Safe(), DB: g.DB("default"), Table: "ops_operation_event", Columns: opsOperationEventColumns{ Id: "id", EventNo: "event_no", EventTitle: "event_title", EventDesc: "event_desc", EventType: "event_type", EventStatus: "event_status", EventResult: "event_result", ContractId: "contract_id", ContractName: "contract_name", CustId: "cust_id", CustName: "cust_name", ProductLine: "product_line", IsBig: "is_big", IsOps: "is_ops", PriorityLevel: "priority_level", FeedbackSource: "feedback_source", FeedbackReporter: "feedback_reporter", FeedbackDate: "feedback_date", OpsUserId: "ops_user_id", OpsUserName: "ops_user_name", AssignTime: "assign_time", CompleteTime: "complete_time", CompleteDesc: "complete_desc", Attribute1: "attribute1", Attribute2: "attribute2", Attribute3: "attribute3", Attribute4: "attribute4", Attribute5: "attribute5", Attribute6: "attribute6", Attribute7: "attribute7", Attribute8: "attribute8", Attribute9: "attribute9", Remark: "remark", CreatedBy: "created_by", CreatedName: "created_name", CreatedTime: "created_time", UpdatedBy: "updated_by", UpdatedName: "updated_name", UpdatedTime: "updated_time", DeletedTime: "deleted_time", }, } ) func NewOpsOperationEventDao(tenant string) OpsOperationEventDao { var dao OpsOperationEventDao dao = OpsOperationEventDao{ M: g.DB(tenant).Model("ops_operation_event").Safe(), DB: g.DB(tenant), Table: "ops_operation_event", Columns: opsOperationEventColumns{ Id: "id", EventNo: "event_no", EventTitle: "event_title", EventDesc: "event_desc", EventType: "event_type", EventStatus: "event_status", EventResult: "event_result", ContractId: "contract_id", ContractName: "contract_name", CustId: "cust_id", CustName: "cust_name", ProductLine: "product_line", IsBig: "is_big", IsOps: "is_ops", PriorityLevel: "priority_level", FeedbackSource: "feedback_source", FeedbackReporter: "feedback_reporter", FeedbackDate: "feedback_date", OpsUserId: "ops_user_id", OpsUserName: "ops_user_name", AssignTime: "assign_time", CompleteTime: "complete_time", CompleteDesc: "complete_desc", Attribute1: "attribute1", Attribute2: "attribute2", Attribute3: "attribute3", Attribute4: "attribute4", Attribute5: "attribute5", Attribute6: "attribute6", Attribute7: "attribute7", Attribute8: "attribute8", Attribute9: "attribute9", Remark: "remark", CreatedBy: "created_by", CreatedName: "created_name", CreatedTime: "created_time", UpdatedBy: "updated_by", UpdatedName: "updated_name", UpdatedTime: "updated_time", DeletedTime: "deleted_time", }, } return dao } // Ctx is a chaining function, which creates and returns a new DB that is a shallow copy // of current DB object and with given context in it. // Note that this returned DB object can be used only once, so do not assign it to // a global or package variable for long using. func (d *OpsOperationEventDao) Ctx(ctx context.Context) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Ctx(ctx)} } // As sets an alias name for current table. func (d *OpsOperationEventDao) As(as string) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.As(as)} } // TX sets the transaction for current operation. func (d *OpsOperationEventDao) TX(tx *gdb.TX) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.TX(tx)} } // Master marks the following operation on master node. func (d *OpsOperationEventDao) Master() *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Master()} } // Slave marks the following operation on slave node. // Note that it makes sense only if there's any slave node configured. func (d *OpsOperationEventDao) Slave() *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Slave()} } // Args sets custom arguments for model operation. func (d *OpsOperationEventDao) Args(args ...interface{}) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Args(args...)} } // LeftJoin does "LEFT JOIN ... ON ..." statement on the model. // The parameter can be joined table and its joined condition, // and also with its alias name, like: // Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid") // Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid") func (d *OpsOperationEventDao) LeftJoin(table ...string) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.LeftJoin(table...)} } // RightJoin does "RIGHT JOIN ... ON ..." statement on the model. // The parameter
can be joined table and its joined condition, // and also with its alias name, like: // Table("user").RightJoin("user_detail", "user_detail.uid=user.uid") // Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid") func (d *OpsOperationEventDao) RightJoin(table ...string) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.RightJoin(table...)} } // InnerJoin does "INNER JOIN ... ON ..." statement on the model. // The parameter
can be joined table and its joined condition, // and also with its alias name, like: // Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid") // Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid") func (d *OpsOperationEventDao) InnerJoin(table ...string) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.InnerJoin(table...)} } // Fields sets the operation fields of the model, multiple fields joined using char ','. // The parameter can be type of string/map/*map/struct/*struct. func (d *OpsOperationEventDao) Fields(fieldNamesOrMapStruct ...interface{}) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Fields(fieldNamesOrMapStruct...)} } // FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','. // The parameter can be type of string/map/*map/struct/*struct. func (d *OpsOperationEventDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)} } // Option sets the extra operation option for the model. func (d *OpsOperationEventDao) Option(option int) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Option(option)} } // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers // the data and where attributes for empty values. func (d *OpsOperationEventDao) OmitEmpty() *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.OmitEmpty()} } // Filter marks filtering the fields which does not exist in the fields of the operated table. func (d *OpsOperationEventDao) Filter() *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Filter()} } // Where sets the condition statement for the model. The parameter can be type of // string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times, // multiple conditions will be joined into where statement using "AND". // Eg: // Where("uid=10000") // Where("uid", 10000) // Where("money>? AND name like ?", 99999, "vip_%") // Where("uid", 1).Where("name", "john") // Where("status IN (?)", g.Slice{1,2,3}) // Where("age IN(?,?)", 18, 50) // Where(User{ Id : 1, UserName : "john"}) func (d *OpsOperationEventDao) Where(where interface{}, args ...interface{}) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Where(where, args...)} } // WherePri does the same logic as M.Where except that if the parameter // is a single condition like int/string/float/slice, it treats the condition as the primary // key value. That is, if primary key is "id" and given parameter as "123", the // WherePri function treats the condition as "id=123", but M.Where treats the condition // as string "123". func (d *OpsOperationEventDao) WherePri(where interface{}, args ...interface{}) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.WherePri(where, args...)} } // And adds "AND" condition to the where statement. func (d *OpsOperationEventDao) And(where interface{}, args ...interface{}) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.And(where, args...)} } // Or adds "OR" condition to the where statement. func (d *OpsOperationEventDao) Or(where interface{}, args ...interface{}) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Or(where, args...)} } // Group sets the "GROUP BY" statement for the model. func (d *OpsOperationEventDao) Group(groupBy string) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Group(groupBy)} } // Order sets the "ORDER BY" statement for the model. func (d *OpsOperationEventDao) Order(orderBy ...string) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Order(orderBy...)} } // Limit sets the "LIMIT" statement for the model. // The parameter can be either one or two number, if passed two number is passed, // it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]" // statement. func (d *OpsOperationEventDao) Limit(limit ...int) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Limit(limit...)} } // Offset sets the "OFFSET" statement for the model. // It only makes sense for some databases like SQLServer, PostgreSQL, etc. func (d *OpsOperationEventDao) Offset(offset int) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Offset(offset)} } // Page sets the paging number for the model. // The parameter is started from 1 for paging. // Note that, it differs that the Limit function start from 0 for "LIMIT" statement. func (d *OpsOperationEventDao) Page(page, limit int) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Page(page, limit)} } // Batch sets the batch operation number for the model. func (d *OpsOperationEventDao) Batch(batch int) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Batch(batch)} } // Cache sets the cache feature for the model. It caches the result of the sql, which means // if there's another same sql request, it just reads and returns the result from cache, it // but not committed and executed into the database. // // If the parameter < 0, which means it clear the cache with given . // If the parameter = 0, which means it never expires. // If the parameter > 0, which means it expires after . // // The optional parameter is used to bind a name to the cache, which means you can later // control the cache like changing the or clearing the cache with specified . // // Note that, the cache feature is disabled if the model is operating on a transaction. func (d *OpsOperationEventDao) Cache(duration time.Duration, name ...string) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Cache(duration, name...)} } // Data sets the operation data for the model. // The parameter can be type of string/map/gmap/slice/struct/*struct, etc. // Eg: // Data("uid=10000") // Data("uid", 10000) // Data(g.Map{"uid": 10000, "name":"john"}) // Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"}) func (d *OpsOperationEventDao) Data(data ...interface{}) *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Data(data...)} } // All does "SELECT FROM ..." statement for the model. // It retrieves the records from table and returns the result as []*model.OpsOperationEvent. // It returns nil if there's no record retrieved with the given conditions from table. // // The optional parameter is the same as the parameter of M.Where function, // see M.Where. func (d *OpsOperationEventDao) All(where ...interface{}) ([]*opsdev.OpsOperationEvent, error) { all, err := d.M.All(where...) if err != nil { return nil, err } var entities []*opsdev.OpsOperationEvent if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows { return nil, err } return entities, nil } // One retrieves one record from table and returns the result as *model.OpsOperationEvent. // It returns nil if there's no record retrieved with the given conditions from table. // // The optional parameter is the same as the parameter of M.Where function, // see M.Where. func (d *OpsOperationEventDao) One(where ...interface{}) (*opsdev.OpsOperationEvent, error) { one, err := d.M.One(where...) if err != nil { return nil, err } var entity *opsdev.OpsOperationEvent if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows { return nil, err } return entity, nil } // FindOne retrieves and returns a single Record by M.WherePri and M.One. // Also see M.WherePri and M.One. func (d *OpsOperationEventDao) FindOne(where ...interface{}) (*opsdev.OpsOperationEvent, error) { one, err := d.M.FindOne(where...) if err != nil { return nil, err } var entity *opsdev.OpsOperationEvent if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows { return nil, err } return entity, nil } // FindAll retrieves and returns Result by by M.WherePri and M.All. // Also see M.WherePri and M.All. func (d *OpsOperationEventDao) FindAll(where ...interface{}) ([]*opsdev.OpsOperationEvent, error) { all, err := d.M.FindAll(where...) if err != nil { return nil, err } var entities []*opsdev.OpsOperationEvent if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows { return nil, err } return entities, nil } // Struct retrieves one record from table and converts it into given struct. // The parameter should be type of *struct/**struct. If type **struct is given, // it can create the struct internally during converting. // // The optional parameter is the same as the parameter of Model.Where function, // see Model.Where. // // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions // from table and is not nil. // // Eg: // user := new(User) // err := dao.User.Where("id", 1).Struct(user) // // user := (*User)(nil) // err := dao.User.Where("id", 1).Struct(&user) func (d *OpsOperationEventDao) Struct(pointer interface{}, where ...interface{}) error { return d.M.Struct(pointer, where...) } // Structs retrieves records from table and converts them into given struct slice. // The parameter should be type of *[]struct/*[]*struct. It can create and fill the struct // slice internally during converting. // // The optional parameter is the same as the parameter of Model.Where function, // see Model.Where. // // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions // from table and is not empty. // // Eg: // users := ([]User)(nil) // err := dao.User.Structs(&users) // // users := ([]*User)(nil) // err := dao.User.Structs(&users) func (d *OpsOperationEventDao) Structs(pointer interface{}, where ...interface{}) error { return d.M.Structs(pointer, where...) } // Scan automatically calls Struct or Structs function according to the type of parameter . // It calls function Struct if is type of *struct/**struct. // It calls function Structs if is type of *[]struct/*[]*struct. // // The optional parameter is the same as the parameter of Model.Where function, // see Model.Where. // // Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil. // // Eg: // user := new(User) // err := dao.User.Where("id", 1).Scan(user) // // user := (*User)(nil) // err := dao.User.Where("id", 1).Scan(&user) // // users := ([]User)(nil) // err := dao.User.Scan(&users) // // users := ([]*User)(nil) // err := dao.User.Scan(&users) func (d *OpsOperationEventDao) Scan(pointer interface{}, where ...interface{}) error { return d.M.Scan(pointer, where...) } // Chunk iterates the table with given size and callback function. func (d *OpsOperationEventDao) Chunk(limit int, callback func(entities []*opsdev.OpsOperationEvent, err error) bool) { d.M.Chunk(limit, func(result gdb.Result, err error) bool { var entities []*opsdev.OpsOperationEvent err = result.Structs(&entities) if err == sql.ErrNoRows { return false } return callback(entities, err) }) } // LockUpdate sets the lock for update for current operation. func (d *OpsOperationEventDao) LockUpdate() *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.LockUpdate()} } // LockShared sets the lock in share mode for current operation. func (d *OpsOperationEventDao) LockShared() *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.LockShared()} } // Unscoped enables/disables the soft deleting feature. func (d *OpsOperationEventDao) Unscoped() *OpsOperationEventDao { return &OpsOperationEventDao{M: d.M.Unscoped()} }