// 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 newMismatchRecord(db *gorm.DB, opts ...gen.DOOption) mismatchRecord { _mismatchRecord := mismatchRecord{} _mismatchRecord.mismatchRecordDo.UseDB(db, opts...) _mismatchRecord.mismatchRecordDo.UseModel(&model.MismatchRecord{}) tableName := _mismatchRecord.mismatchRecordDo.TableName() _mismatchRecord.ALL = field.NewAsterisk(tableName) _mismatchRecord.ID = field.NewString(tableName, "id") _mismatchRecord.ExternalID = field.NewString(tableName, "external_id") _mismatchRecord.IndustryType = field.NewInt64(tableName, "industry_type") _mismatchRecord.ChatHistory = field.NewString(tableName, "chat_history") _mismatchRecord.Missed = field.NewString(tableName, "missed") _mismatchRecord.Ignore = field.NewInt64(tableName, "ignore") _mismatchRecord.LlmIgnore = field.NewInt64(tableName, "llm_ignore") _mismatchRecord.OrgID = field.NewInt64(tableName, "org_id") _mismatchRecord.Status = field.NewInt64(tableName, "status") _mismatchRecord.IgnoreResponseData = field.NewString(tableName, "ignore_response_data") _mismatchRecord.RequestData = field.NewString(tableName, "request_data") _mismatchRecord.ResponseData = field.NewString(tableName, "response_data") _mismatchRecord.CreatedAt = field.NewTime(tableName, "created_at") _mismatchRecord.UpdatedAt = field.NewTime(tableName, "updated_at") _mismatchRecord.UserIntent = field.NewString(tableName, "user_intent") _mismatchRecord.SimilarReply = field.NewString(tableName, "similar_reply") _mismatchRecord.Keywords = field.NewString(tableName, "keywords") _mismatchRecord.Regular = field.NewString(tableName, "regular") _mismatchRecord.fillFieldMap() return _mismatchRecord } type mismatchRecord struct { mismatchRecordDo ALL field.Asterisk ID field.String // 主键id ExternalID field.String // 外部id IndustryType field.Int64 // 评分规则代码 0 通用 1 教育 ChatHistory field.String // 通话记录 Missed field.String // 未匹配内容 Ignore field.Int64 // 0 自动过滤(默认) 1 手动标记忽略 2 不忽略强制分析 LlmIgnore field.Int64 // 0 未过滤 1被忽略 2未被忽略 OrgID field.Int64 // 机构 ID Status field.Int64 // 状态 1 入库 2 已判断 3 已回调 IgnoreResponseData field.String RequestData field.String ResponseData field.String CreatedAt field.Time // Create Time | 创建日期 UpdatedAt field.Time // Update Time | 修改日期 UserIntent field.String // 针对未匹配内容,推理用户的真实目的 SimilarReply field.String // 针对未匹配内容,生成类似的回复 Keywords field.String // 生成辅助关键词 Regular field.String // 生成辅助正则表达式 fieldMap map[string]field.Expr } func (m mismatchRecord) Table(newTableName string) *mismatchRecord { m.mismatchRecordDo.UseTable(newTableName) return m.updateTableName(newTableName) } func (m mismatchRecord) As(alias string) *mismatchRecord { m.mismatchRecordDo.DO = *(m.mismatchRecordDo.As(alias).(*gen.DO)) return m.updateTableName(alias) } func (m *mismatchRecord) updateTableName(table string) *mismatchRecord { m.ALL = field.NewAsterisk(table) m.ID = field.NewString(table, "id") m.ExternalID = field.NewString(table, "external_id") m.IndustryType = field.NewInt64(table, "industry_type") m.ChatHistory = field.NewString(table, "chat_history") m.Missed = field.NewString(table, "missed") m.Ignore = field.NewInt64(table, "ignore") m.LlmIgnore = field.NewInt64(table, "llm_ignore") m.OrgID = field.NewInt64(table, "org_id") m.Status = field.NewInt64(table, "status") m.IgnoreResponseData = field.NewString(table, "ignore_response_data") m.RequestData = field.NewString(table, "request_data") m.ResponseData = field.NewString(table, "response_data") m.CreatedAt = field.NewTime(table, "created_at") m.UpdatedAt = field.NewTime(table, "updated_at") m.UserIntent = field.NewString(table, "user_intent") m.SimilarReply = field.NewString(table, "similar_reply") m.Keywords = field.NewString(table, "keywords") m.Regular = field.NewString(table, "regular") m.fillFieldMap() return m } func (m *mismatchRecord) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := m.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (m *mismatchRecord) fillFieldMap() { m.fieldMap = make(map[string]field.Expr, 18) m.fieldMap["id"] = m.ID m.fieldMap["external_id"] = m.ExternalID m.fieldMap["industry_type"] = m.IndustryType m.fieldMap["chat_history"] = m.ChatHistory m.fieldMap["missed"] = m.Missed m.fieldMap["ignore"] = m.Ignore m.fieldMap["llm_ignore"] = m.LlmIgnore m.fieldMap["org_id"] = m.OrgID m.fieldMap["status"] = m.Status m.fieldMap["ignore_response_data"] = m.IgnoreResponseData m.fieldMap["request_data"] = m.RequestData m.fieldMap["response_data"] = m.ResponseData m.fieldMap["created_at"] = m.CreatedAt m.fieldMap["updated_at"] = m.UpdatedAt m.fieldMap["user_intent"] = m.UserIntent m.fieldMap["similar_reply"] = m.SimilarReply m.fieldMap["keywords"] = m.Keywords m.fieldMap["regular"] = m.Regular } func (m mismatchRecord) clone(db *gorm.DB) mismatchRecord { m.mismatchRecordDo.ReplaceConnPool(db.Statement.ConnPool) return m } func (m mismatchRecord) replaceDB(db *gorm.DB) mismatchRecord { m.mismatchRecordDo.ReplaceDB(db) return m } type mismatchRecordDo struct{ gen.DO } type IMismatchRecordDo interface { gen.SubQuery Debug() IMismatchRecordDo WithContext(ctx context.Context) IMismatchRecordDo WithResult(fc func(tx gen.Dao)) gen.ResultInfo ReplaceDB(db *gorm.DB) ReadDB() IMismatchRecordDo WriteDB() IMismatchRecordDo As(alias string) gen.Dao Session(config *gorm.Session) IMismatchRecordDo Columns(cols ...field.Expr) gen.Columns Clauses(conds ...clause.Expression) IMismatchRecordDo Not(conds ...gen.Condition) IMismatchRecordDo Or(conds ...gen.Condition) IMismatchRecordDo Select(conds ...field.Expr) IMismatchRecordDo Where(conds ...gen.Condition) IMismatchRecordDo Order(conds ...field.Expr) IMismatchRecordDo Distinct(cols ...field.Expr) IMismatchRecordDo Omit(cols ...field.Expr) IMismatchRecordDo Join(table schema.Tabler, on ...field.Expr) IMismatchRecordDo LeftJoin(table schema.Tabler, on ...field.Expr) IMismatchRecordDo RightJoin(table schema.Tabler, on ...field.Expr) IMismatchRecordDo Group(cols ...field.Expr) IMismatchRecordDo Having(conds ...gen.Condition) IMismatchRecordDo Limit(limit int) IMismatchRecordDo Offset(offset int) IMismatchRecordDo Count() (count int64, err error) Scopes(funcs ...func(gen.Dao) gen.Dao) IMismatchRecordDo Unscoped() IMismatchRecordDo Create(values ...*model.MismatchRecord) error CreateInBatches(values []*model.MismatchRecord, batchSize int) error Save(values ...*model.MismatchRecord) error First() (*model.MismatchRecord, error) Take() (*model.MismatchRecord, error) Last() (*model.MismatchRecord, error) Find() ([]*model.MismatchRecord, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.MismatchRecord, err error) FindInBatches(result *[]*model.MismatchRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error Pluck(column field.Expr, dest interface{}) error Delete(...*model.MismatchRecord) (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) IMismatchRecordDo Assign(attrs ...field.AssignExpr) IMismatchRecordDo Joins(fields ...field.RelationField) IMismatchRecordDo Preload(fields ...field.RelationField) IMismatchRecordDo FirstOrInit() (*model.MismatchRecord, error) FirstOrCreate() (*model.MismatchRecord, error) FindByPage(offset int, limit int) (result []*model.MismatchRecord, 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) IMismatchRecordDo UnderlyingDB() *gorm.DB schema.Tabler } func (m mismatchRecordDo) Debug() IMismatchRecordDo { return m.withDO(m.DO.Debug()) } func (m mismatchRecordDo) WithContext(ctx context.Context) IMismatchRecordDo { return m.withDO(m.DO.WithContext(ctx)) } func (m mismatchRecordDo) ReadDB() IMismatchRecordDo { return m.Clauses(dbresolver.Read) } func (m mismatchRecordDo) WriteDB() IMismatchRecordDo { return m.Clauses(dbresolver.Write) } func (m mismatchRecordDo) Session(config *gorm.Session) IMismatchRecordDo { return m.withDO(m.DO.Session(config)) } func (m mismatchRecordDo) Clauses(conds ...clause.Expression) IMismatchRecordDo { return m.withDO(m.DO.Clauses(conds...)) } func (m mismatchRecordDo) Returning(value interface{}, columns ...string) IMismatchRecordDo { return m.withDO(m.DO.Returning(value, columns...)) } func (m mismatchRecordDo) Not(conds ...gen.Condition) IMismatchRecordDo { return m.withDO(m.DO.Not(conds...)) } func (m mismatchRecordDo) Or(conds ...gen.Condition) IMismatchRecordDo { return m.withDO(m.DO.Or(conds...)) } func (m mismatchRecordDo) Select(conds ...field.Expr) IMismatchRecordDo { return m.withDO(m.DO.Select(conds...)) } func (m mismatchRecordDo) Where(conds ...gen.Condition) IMismatchRecordDo { return m.withDO(m.DO.Where(conds...)) } func (m mismatchRecordDo) Order(conds ...field.Expr) IMismatchRecordDo { return m.withDO(m.DO.Order(conds...)) } func (m mismatchRecordDo) Distinct(cols ...field.Expr) IMismatchRecordDo { return m.withDO(m.DO.Distinct(cols...)) } func (m mismatchRecordDo) Omit(cols ...field.Expr) IMismatchRecordDo { return m.withDO(m.DO.Omit(cols...)) } func (m mismatchRecordDo) Join(table schema.Tabler, on ...field.Expr) IMismatchRecordDo { return m.withDO(m.DO.Join(table, on...)) } func (m mismatchRecordDo) LeftJoin(table schema.Tabler, on ...field.Expr) IMismatchRecordDo { return m.withDO(m.DO.LeftJoin(table, on...)) } func (m mismatchRecordDo) RightJoin(table schema.Tabler, on ...field.Expr) IMismatchRecordDo { return m.withDO(m.DO.RightJoin(table, on...)) } func (m mismatchRecordDo) Group(cols ...field.Expr) IMismatchRecordDo { return m.withDO(m.DO.Group(cols...)) } func (m mismatchRecordDo) Having(conds ...gen.Condition) IMismatchRecordDo { return m.withDO(m.DO.Having(conds...)) } func (m mismatchRecordDo) Limit(limit int) IMismatchRecordDo { return m.withDO(m.DO.Limit(limit)) } func (m mismatchRecordDo) Offset(offset int) IMismatchRecordDo { return m.withDO(m.DO.Offset(offset)) } func (m mismatchRecordDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IMismatchRecordDo { return m.withDO(m.DO.Scopes(funcs...)) } func (m mismatchRecordDo) Unscoped() IMismatchRecordDo { return m.withDO(m.DO.Unscoped()) } func (m mismatchRecordDo) Create(values ...*model.MismatchRecord) error { if len(values) == 0 { return nil } return m.DO.Create(values) } func (m mismatchRecordDo) CreateInBatches(values []*model.MismatchRecord, batchSize int) error { return m.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 (m mismatchRecordDo) Save(values ...*model.MismatchRecord) error { if len(values) == 0 { return nil } return m.DO.Save(values) } func (m mismatchRecordDo) First() (*model.MismatchRecord, error) { if result, err := m.DO.First(); err != nil { return nil, err } else { return result.(*model.MismatchRecord), nil } } func (m mismatchRecordDo) Take() (*model.MismatchRecord, error) { if result, err := m.DO.Take(); err != nil { return nil, err } else { return result.(*model.MismatchRecord), nil } } func (m mismatchRecordDo) Last() (*model.MismatchRecord, error) { if result, err := m.DO.Last(); err != nil { return nil, err } else { return result.(*model.MismatchRecord), nil } } func (m mismatchRecordDo) Find() ([]*model.MismatchRecord, error) { result, err := m.DO.Find() return result.([]*model.MismatchRecord), err } func (m mismatchRecordDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.MismatchRecord, err error) { buf := make([]*model.MismatchRecord, 0, batchSize) err = m.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 (m mismatchRecordDo) FindInBatches(result *[]*model.MismatchRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error { return m.DO.FindInBatches(result, batchSize, fc) } func (m mismatchRecordDo) Attrs(attrs ...field.AssignExpr) IMismatchRecordDo { return m.withDO(m.DO.Attrs(attrs...)) } func (m mismatchRecordDo) Assign(attrs ...field.AssignExpr) IMismatchRecordDo { return m.withDO(m.DO.Assign(attrs...)) } func (m mismatchRecordDo) Joins(fields ...field.RelationField) IMismatchRecordDo { for _, _f := range fields { m = *m.withDO(m.DO.Joins(_f)) } return &m } func (m mismatchRecordDo) Preload(fields ...field.RelationField) IMismatchRecordDo { for _, _f := range fields { m = *m.withDO(m.DO.Preload(_f)) } return &m } func (m mismatchRecordDo) FirstOrInit() (*model.MismatchRecord, error) { if result, err := m.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.MismatchRecord), nil } } func (m mismatchRecordDo) FirstOrCreate() (*model.MismatchRecord, error) { if result, err := m.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.MismatchRecord), nil } } func (m mismatchRecordDo) FindByPage(offset int, limit int) (result []*model.MismatchRecord, count int64, err error) { result, err = m.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 = m.Offset(-1).Limit(-1).Count() return } func (m mismatchRecordDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = m.Count() if err != nil { return } err = m.Offset(offset).Limit(limit).Scan(result) return } func (m mismatchRecordDo) Scan(result interface{}) (err error) { return m.DO.Scan(result) } func (m mismatchRecordDo) Delete(models ...*model.MismatchRecord) (result gen.ResultInfo, err error) { return m.DO.Delete(models) } func (m *mismatchRecordDo) withDO(do gen.Dao) *mismatchRecordDo { m.DO = *do.(*gen.DO) return m }