// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gorm.io/gen. DO NOT EDIT. package query import ( "context" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gen" "gorm.io/gen/field" "gorm.io/plugin/dbresolver" "wechat-api/database/dao/wechat/model" ) func newSopNode(db *gorm.DB, opts ...gen.DOOption) sopNode { _sopNode := sopNode{} _sopNode.sopNodeDo.UseDB(db, opts...) _sopNode.sopNodeDo.UseModel(&model.SopNode{}) tableName := _sopNode.sopNodeDo.TableName() _sopNode.ALL = field.NewAsterisk(tableName) _sopNode.ID = field.NewInt64(tableName, "id") _sopNode.CreatedAt = field.NewTime(tableName, "created_at") _sopNode.UpdatedAt = field.NewTime(tableName, "updated_at") _sopNode.Status = field.NewInt64(tableName, "status") _sopNode.DeletedAt = field.NewField(tableName, "deleted_at") _sopNode.StageID = field.NewInt64(tableName, "stage_id") _sopNode.ParentID = field.NewInt64(tableName, "parent_id") _sopNode.Name = field.NewString(tableName, "name") _sopNode.ConditionType = field.NewInt64(tableName, "condition_type") _sopNode.ConditionList = field.NewString(tableName, "condition_list") _sopNode.NoReplyCondition = field.NewInt64(tableName, "no_reply_condition") _sopNode.ActionMessage = field.NewString(tableName, "action_message") _sopNode.ActionLabelAdd = field.NewString(tableName, "action_label_add") _sopNode.ActionForward = field.NewString(tableName, "action_forward") _sopNode.NoReplyUnit = field.NewString(tableName, "no_reply_unit") _sopNode.ActionLabelDel = field.NewString(tableName, "action_label_del") _sopNode.fillFieldMap() return _sopNode } type sopNode struct { sopNodeDo ALL field.Asterisk ID field.Int64 CreatedAt field.Time // Create Time | 创建日期 UpdatedAt field.Time // Update Time | 修改日期 Status field.Int64 // 状态 1 正常 2 禁用 DeletedAt field.Field // Delete Time | 删除日期 StageID field.Int64 // 阶段 ID ParentID field.Int64 // 父节点 ID Name field.String // 节点名称 ConditionType field.Int64 // 触发条件类型 1 客户回复后触发 2 超时后触发 ConditionList field.String // 触发语义列表 当为空时则代表用户回复任意内容后触发 NoReplyCondition field.Int64 // 超时触发时间(分钟) ActionMessage field.String // 命中后发送的消息内容 ActionLabelAdd field.String // 命中后需要打的标签 ActionForward field.String // 命中后转发的消息 NoReplyUnit field.String // 超时触发时间单位 ActionLabelDel field.String // 命中后需要打的标签 fieldMap map[string]field.Expr } func (s sopNode) Table(newTableName string) *sopNode { s.sopNodeDo.UseTable(newTableName) return s.updateTableName(newTableName) } func (s sopNode) As(alias string) *sopNode { s.sopNodeDo.DO = *(s.sopNodeDo.As(alias).(*gen.DO)) return s.updateTableName(alias) } func (s *sopNode) updateTableName(table string) *sopNode { s.ALL = field.NewAsterisk(table) s.ID = field.NewInt64(table, "id") s.CreatedAt = field.NewTime(table, "created_at") s.UpdatedAt = field.NewTime(table, "updated_at") s.Status = field.NewInt64(table, "status") s.DeletedAt = field.NewField(table, "deleted_at") s.StageID = field.NewInt64(table, "stage_id") s.ParentID = field.NewInt64(table, "parent_id") s.Name = field.NewString(table, "name") s.ConditionType = field.NewInt64(table, "condition_type") s.ConditionList = field.NewString(table, "condition_list") s.NoReplyCondition = field.NewInt64(table, "no_reply_condition") s.ActionMessage = field.NewString(table, "action_message") s.ActionLabelAdd = field.NewString(table, "action_label_add") s.ActionForward = field.NewString(table, "action_forward") s.NoReplyUnit = field.NewString(table, "no_reply_unit") s.ActionLabelDel = field.NewString(table, "action_label_del") s.fillFieldMap() return s } func (s *sopNode) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := s.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (s *sopNode) fillFieldMap() { s.fieldMap = make(map[string]field.Expr, 16) s.fieldMap["id"] = s.ID s.fieldMap["created_at"] = s.CreatedAt s.fieldMap["updated_at"] = s.UpdatedAt s.fieldMap["status"] = s.Status s.fieldMap["deleted_at"] = s.DeletedAt s.fieldMap["stage_id"] = s.StageID s.fieldMap["parent_id"] = s.ParentID s.fieldMap["name"] = s.Name s.fieldMap["condition_type"] = s.ConditionType s.fieldMap["condition_list"] = s.ConditionList s.fieldMap["no_reply_condition"] = s.NoReplyCondition s.fieldMap["action_message"] = s.ActionMessage s.fieldMap["action_label_add"] = s.ActionLabelAdd s.fieldMap["action_forward"] = s.ActionForward s.fieldMap["no_reply_unit"] = s.NoReplyUnit s.fieldMap["action_label_del"] = s.ActionLabelDel } func (s sopNode) clone(db *gorm.DB) sopNode { s.sopNodeDo.ReplaceConnPool(db.Statement.ConnPool) return s } func (s sopNode) replaceDB(db *gorm.DB) sopNode { s.sopNodeDo.ReplaceDB(db) return s } type sopNodeDo struct{ gen.DO } type ISopNodeDo interface { gen.SubQuery Debug() ISopNodeDo WithContext(ctx context.Context) ISopNodeDo WithResult(fc func(tx gen.Dao)) gen.ResultInfo ReplaceDB(db *gorm.DB) ReadDB() ISopNodeDo WriteDB() ISopNodeDo As(alias string) gen.Dao Session(config *gorm.Session) ISopNodeDo Columns(cols ...field.Expr) gen.Columns Clauses(conds ...clause.Expression) ISopNodeDo Not(conds ...gen.Condition) ISopNodeDo Or(conds ...gen.Condition) ISopNodeDo Select(conds ...field.Expr) ISopNodeDo Where(conds ...gen.Condition) ISopNodeDo Order(conds ...field.Expr) ISopNodeDo Distinct(cols ...field.Expr) ISopNodeDo Omit(cols ...field.Expr) ISopNodeDo Join(table schema.Tabler, on ...field.Expr) ISopNodeDo LeftJoin(table schema.Tabler, on ...field.Expr) ISopNodeDo RightJoin(table schema.Tabler, on ...field.Expr) ISopNodeDo Group(cols ...field.Expr) ISopNodeDo Having(conds ...gen.Condition) ISopNodeDo Limit(limit int) ISopNodeDo Offset(offset int) ISopNodeDo Count() (count int64, err error) Scopes(funcs ...func(gen.Dao) gen.Dao) ISopNodeDo Unscoped() ISopNodeDo Create(values ...*model.SopNode) error CreateInBatches(values []*model.SopNode, batchSize int) error Save(values ...*model.SopNode) error First() (*model.SopNode, error) Take() (*model.SopNode, error) Last() (*model.SopNode, error) Find() ([]*model.SopNode, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SopNode, err error) FindInBatches(result *[]*model.SopNode, batchSize int, fc func(tx gen.Dao, batch int) error) error Pluck(column field.Expr, dest interface{}) error Delete(...*model.SopNode) (info gen.ResultInfo, err error) Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) Updates(value interface{}) (info gen.ResultInfo, err error) UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) UpdateColumns(value interface{}) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) ISopNodeDo Assign(attrs ...field.AssignExpr) ISopNodeDo Joins(fields ...field.RelationField) ISopNodeDo Preload(fields ...field.RelationField) ISopNodeDo FirstOrInit() (*model.SopNode, error) FirstOrCreate() (*model.SopNode, error) FindByPage(offset int, limit int) (result []*model.SopNode, count int64, err error) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) Scan(result interface{}) (err error) Returning(value interface{}, columns ...string) ISopNodeDo UnderlyingDB() *gorm.DB schema.Tabler } func (s sopNodeDo) Debug() ISopNodeDo { return s.withDO(s.DO.Debug()) } func (s sopNodeDo) WithContext(ctx context.Context) ISopNodeDo { return s.withDO(s.DO.WithContext(ctx)) } func (s sopNodeDo) ReadDB() ISopNodeDo { return s.Clauses(dbresolver.Read) } func (s sopNodeDo) WriteDB() ISopNodeDo { return s.Clauses(dbresolver.Write) } func (s sopNodeDo) Session(config *gorm.Session) ISopNodeDo { return s.withDO(s.DO.Session(config)) } func (s sopNodeDo) Clauses(conds ...clause.Expression) ISopNodeDo { return s.withDO(s.DO.Clauses(conds...)) } func (s sopNodeDo) Returning(value interface{}, columns ...string) ISopNodeDo { return s.withDO(s.DO.Returning(value, columns...)) } func (s sopNodeDo) Not(conds ...gen.Condition) ISopNodeDo { return s.withDO(s.DO.Not(conds...)) } func (s sopNodeDo) Or(conds ...gen.Condition) ISopNodeDo { return s.withDO(s.DO.Or(conds...)) } func (s sopNodeDo) Select(conds ...field.Expr) ISopNodeDo { return s.withDO(s.DO.Select(conds...)) } func (s sopNodeDo) Where(conds ...gen.Condition) ISopNodeDo { return s.withDO(s.DO.Where(conds...)) } func (s sopNodeDo) Order(conds ...field.Expr) ISopNodeDo { return s.withDO(s.DO.Order(conds...)) } func (s sopNodeDo) Distinct(cols ...field.Expr) ISopNodeDo { return s.withDO(s.DO.Distinct(cols...)) } func (s sopNodeDo) Omit(cols ...field.Expr) ISopNodeDo { return s.withDO(s.DO.Omit(cols...)) } func (s sopNodeDo) Join(table schema.Tabler, on ...field.Expr) ISopNodeDo { return s.withDO(s.DO.Join(table, on...)) } func (s sopNodeDo) LeftJoin(table schema.Tabler, on ...field.Expr) ISopNodeDo { return s.withDO(s.DO.LeftJoin(table, on...)) } func (s sopNodeDo) RightJoin(table schema.Tabler, on ...field.Expr) ISopNodeDo { return s.withDO(s.DO.RightJoin(table, on...)) } func (s sopNodeDo) Group(cols ...field.Expr) ISopNodeDo { return s.withDO(s.DO.Group(cols...)) } func (s sopNodeDo) Having(conds ...gen.Condition) ISopNodeDo { return s.withDO(s.DO.Having(conds...)) } func (s sopNodeDo) Limit(limit int) ISopNodeDo { return s.withDO(s.DO.Limit(limit)) } func (s sopNodeDo) Offset(offset int) ISopNodeDo { return s.withDO(s.DO.Offset(offset)) } func (s sopNodeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ISopNodeDo { return s.withDO(s.DO.Scopes(funcs...)) } func (s sopNodeDo) Unscoped() ISopNodeDo { return s.withDO(s.DO.Unscoped()) } func (s sopNodeDo) Create(values ...*model.SopNode) error { if len(values) == 0 { return nil } return s.DO.Create(values) } func (s sopNodeDo) CreateInBatches(values []*model.SopNode, batchSize int) error { return s.DO.CreateInBatches(values, batchSize) } // Save : !!! underlying implementation is different with GORM // The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) func (s sopNodeDo) Save(values ...*model.SopNode) error { if len(values) == 0 { return nil } return s.DO.Save(values) } func (s sopNodeDo) First() (*model.SopNode, error) { if result, err := s.DO.First(); err != nil { return nil, err } else { return result.(*model.SopNode), nil } } func (s sopNodeDo) Take() (*model.SopNode, error) { if result, err := s.DO.Take(); err != nil { return nil, err } else { return result.(*model.SopNode), nil } } func (s sopNodeDo) Last() (*model.SopNode, error) { if result, err := s.DO.Last(); err != nil { return nil, err } else { return result.(*model.SopNode), nil } } func (s sopNodeDo) Find() ([]*model.SopNode, error) { result, err := s.DO.Find() return result.([]*model.SopNode), err } func (s sopNodeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SopNode, err error) { buf := make([]*model.SopNode, 0, batchSize) err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { defer func() { results = append(results, buf...) }() return fc(tx, batch) }) return results, err } func (s sopNodeDo) FindInBatches(result *[]*model.SopNode, batchSize int, fc func(tx gen.Dao, batch int) error) error { return s.DO.FindInBatches(result, batchSize, fc) } func (s sopNodeDo) Attrs(attrs ...field.AssignExpr) ISopNodeDo { return s.withDO(s.DO.Attrs(attrs...)) } func (s sopNodeDo) Assign(attrs ...field.AssignExpr) ISopNodeDo { return s.withDO(s.DO.Assign(attrs...)) } func (s sopNodeDo) Joins(fields ...field.RelationField) ISopNodeDo { for _, _f := range fields { s = *s.withDO(s.DO.Joins(_f)) } return &s } func (s sopNodeDo) Preload(fields ...field.RelationField) ISopNodeDo { for _, _f := range fields { s = *s.withDO(s.DO.Preload(_f)) } return &s } func (s sopNodeDo) FirstOrInit() (*model.SopNode, error) { if result, err := s.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.SopNode), nil } } func (s sopNodeDo) FirstOrCreate() (*model.SopNode, error) { if result, err := s.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.SopNode), nil } } func (s sopNodeDo) FindByPage(offset int, limit int) (result []*model.SopNode, count int64, err error) { result, err = s.Offset(offset).Limit(limit).Find() if err != nil { return } if size := len(result); 0 < limit && 0 < size && size < limit { count = int64(size + offset) return } count, err = s.Offset(-1).Limit(-1).Count() return } func (s sopNodeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = s.Count() if err != nil { return } err = s.Offset(offset).Limit(limit).Scan(result) return } func (s sopNodeDo) Scan(result interface{}) (err error) { return s.DO.Scan(result) } func (s sopNodeDo) Delete(models ...*model.SopNode) (result gen.ResultInfo, err error) { return s.DO.Delete(models) } func (s *sopNodeDo) withDO(do gen.Dao) *sopNodeDo { s.DO = *do.(*gen.DO) return s }