// 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 newIntentRecord(db *gorm.DB, opts ...gen.DOOption) intentRecord { _intentRecord := intentRecord{} _intentRecord.intentRecordDo.UseDB(db, opts...) _intentRecord.intentRecordDo.UseModel(&model.IntentRecord{}) tableName := _intentRecord.intentRecordDo.TableName() _intentRecord.ALL = field.NewAsterisk(tableName) _intentRecord.ID = field.NewString(tableName, "id") _intentRecord.ExternalID = field.NewString(tableName, "external_id") _intentRecord.IndustryType = field.NewInt64(tableName, "industry_type") _intentRecord.ChatHistory = field.NewString(tableName, "chat_history") _intentRecord.ManualIntent = field.NewInt64(tableName, "manual_intent") _intentRecord.LlmIntent = field.NewInt64(tableName, "llm_intent") _intentRecord.OrgID = field.NewInt64(tableName, "org_id") _intentRecord.Status = field.NewInt64(tableName, "status") _intentRecord.RequestData = field.NewString(tableName, "request_data") _intentRecord.ResponseData = field.NewString(tableName, "response_data") _intentRecord.CreatedAt = field.NewTime(tableName, "created_at") _intentRecord.UpdatedAt = field.NewTime(tableName, "updated_at") _intentRecord.fillFieldMap() return _intentRecord } type intentRecord struct { intentRecordDo ALL field.Asterisk ID field.String // 主键id ExternalID field.String // 外部id IndustryType field.Int64 // 评分规则代码 0 通用 1 教育 ChatHistory field.String // 通话记录 ManualIntent field.Int64 // 人工意向度 1 有意向 2 无意向 3 其他 LlmIntent field.Int64 // 大模型意向度 1 有意向 2 无意向 3 不确定 OrgID field.Int64 // 机构 ID Status field.Int64 // 状态 1 入库 2 已判断 3 已回调 RequestData field.String ResponseData field.String CreatedAt field.Time // Create Time | 创建日期 UpdatedAt field.Time // Update Time | 修改日期 fieldMap map[string]field.Expr } func (i intentRecord) Table(newTableName string) *intentRecord { i.intentRecordDo.UseTable(newTableName) return i.updateTableName(newTableName) } func (i intentRecord) As(alias string) *intentRecord { i.intentRecordDo.DO = *(i.intentRecordDo.As(alias).(*gen.DO)) return i.updateTableName(alias) } func (i *intentRecord) updateTableName(table string) *intentRecord { i.ALL = field.NewAsterisk(table) i.ID = field.NewString(table, "id") i.ExternalID = field.NewString(table, "external_id") i.IndustryType = field.NewInt64(table, "industry_type") i.ChatHistory = field.NewString(table, "chat_history") i.ManualIntent = field.NewInt64(table, "manual_intent") i.LlmIntent = field.NewInt64(table, "llm_intent") i.OrgID = field.NewInt64(table, "org_id") i.Status = field.NewInt64(table, "status") i.RequestData = field.NewString(table, "request_data") i.ResponseData = field.NewString(table, "response_data") i.CreatedAt = field.NewTime(table, "created_at") i.UpdatedAt = field.NewTime(table, "updated_at") i.fillFieldMap() return i } func (i *intentRecord) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := i.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (i *intentRecord) fillFieldMap() { i.fieldMap = make(map[string]field.Expr, 12) i.fieldMap["id"] = i.ID i.fieldMap["external_id"] = i.ExternalID i.fieldMap["industry_type"] = i.IndustryType i.fieldMap["chat_history"] = i.ChatHistory i.fieldMap["manual_intent"] = i.ManualIntent i.fieldMap["llm_intent"] = i.LlmIntent i.fieldMap["org_id"] = i.OrgID i.fieldMap["status"] = i.Status i.fieldMap["request_data"] = i.RequestData i.fieldMap["response_data"] = i.ResponseData i.fieldMap["created_at"] = i.CreatedAt i.fieldMap["updated_at"] = i.UpdatedAt } func (i intentRecord) clone(db *gorm.DB) intentRecord { i.intentRecordDo.ReplaceConnPool(db.Statement.ConnPool) return i } func (i intentRecord) replaceDB(db *gorm.DB) intentRecord { i.intentRecordDo.ReplaceDB(db) return i } type intentRecordDo struct{ gen.DO } type IIntentRecordDo interface { gen.SubQuery Debug() IIntentRecordDo WithContext(ctx context.Context) IIntentRecordDo WithResult(fc func(tx gen.Dao)) gen.ResultInfo ReplaceDB(db *gorm.DB) ReadDB() IIntentRecordDo WriteDB() IIntentRecordDo As(alias string) gen.Dao Session(config *gorm.Session) IIntentRecordDo Columns(cols ...field.Expr) gen.Columns Clauses(conds ...clause.Expression) IIntentRecordDo Not(conds ...gen.Condition) IIntentRecordDo Or(conds ...gen.Condition) IIntentRecordDo Select(conds ...field.Expr) IIntentRecordDo Where(conds ...gen.Condition) IIntentRecordDo Order(conds ...field.Expr) IIntentRecordDo Distinct(cols ...field.Expr) IIntentRecordDo Omit(cols ...field.Expr) IIntentRecordDo Join(table schema.Tabler, on ...field.Expr) IIntentRecordDo LeftJoin(table schema.Tabler, on ...field.Expr) IIntentRecordDo RightJoin(table schema.Tabler, on ...field.Expr) IIntentRecordDo Group(cols ...field.Expr) IIntentRecordDo Having(conds ...gen.Condition) IIntentRecordDo Limit(limit int) IIntentRecordDo Offset(offset int) IIntentRecordDo Count() (count int64, err error) Scopes(funcs ...func(gen.Dao) gen.Dao) IIntentRecordDo Unscoped() IIntentRecordDo Create(values ...*model.IntentRecord) error CreateInBatches(values []*model.IntentRecord, batchSize int) error Save(values ...*model.IntentRecord) error First() (*model.IntentRecord, error) Take() (*model.IntentRecord, error) Last() (*model.IntentRecord, error) Find() ([]*model.IntentRecord, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.IntentRecord, err error) FindInBatches(result *[]*model.IntentRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error Pluck(column field.Expr, dest interface{}) error Delete(...*model.IntentRecord) (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) IIntentRecordDo Assign(attrs ...field.AssignExpr) IIntentRecordDo Joins(fields ...field.RelationField) IIntentRecordDo Preload(fields ...field.RelationField) IIntentRecordDo FirstOrInit() (*model.IntentRecord, error) FirstOrCreate() (*model.IntentRecord, error) FindByPage(offset int, limit int) (result []*model.IntentRecord, 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) IIntentRecordDo UnderlyingDB() *gorm.DB schema.Tabler } func (i intentRecordDo) Debug() IIntentRecordDo { return i.withDO(i.DO.Debug()) } func (i intentRecordDo) WithContext(ctx context.Context) IIntentRecordDo { return i.withDO(i.DO.WithContext(ctx)) } func (i intentRecordDo) ReadDB() IIntentRecordDo { return i.Clauses(dbresolver.Read) } func (i intentRecordDo) WriteDB() IIntentRecordDo { return i.Clauses(dbresolver.Write) } func (i intentRecordDo) Session(config *gorm.Session) IIntentRecordDo { return i.withDO(i.DO.Session(config)) } func (i intentRecordDo) Clauses(conds ...clause.Expression) IIntentRecordDo { return i.withDO(i.DO.Clauses(conds...)) } func (i intentRecordDo) Returning(value interface{}, columns ...string) IIntentRecordDo { return i.withDO(i.DO.Returning(value, columns...)) } func (i intentRecordDo) Not(conds ...gen.Condition) IIntentRecordDo { return i.withDO(i.DO.Not(conds...)) } func (i intentRecordDo) Or(conds ...gen.Condition) IIntentRecordDo { return i.withDO(i.DO.Or(conds...)) } func (i intentRecordDo) Select(conds ...field.Expr) IIntentRecordDo { return i.withDO(i.DO.Select(conds...)) } func (i intentRecordDo) Where(conds ...gen.Condition) IIntentRecordDo { return i.withDO(i.DO.Where(conds...)) } func (i intentRecordDo) Order(conds ...field.Expr) IIntentRecordDo { return i.withDO(i.DO.Order(conds...)) } func (i intentRecordDo) Distinct(cols ...field.Expr) IIntentRecordDo { return i.withDO(i.DO.Distinct(cols...)) } func (i intentRecordDo) Omit(cols ...field.Expr) IIntentRecordDo { return i.withDO(i.DO.Omit(cols...)) } func (i intentRecordDo) Join(table schema.Tabler, on ...field.Expr) IIntentRecordDo { return i.withDO(i.DO.Join(table, on...)) } func (i intentRecordDo) LeftJoin(table schema.Tabler, on ...field.Expr) IIntentRecordDo { return i.withDO(i.DO.LeftJoin(table, on...)) } func (i intentRecordDo) RightJoin(table schema.Tabler, on ...field.Expr) IIntentRecordDo { return i.withDO(i.DO.RightJoin(table, on...)) } func (i intentRecordDo) Group(cols ...field.Expr) IIntentRecordDo { return i.withDO(i.DO.Group(cols...)) } func (i intentRecordDo) Having(conds ...gen.Condition) IIntentRecordDo { return i.withDO(i.DO.Having(conds...)) } func (i intentRecordDo) Limit(limit int) IIntentRecordDo { return i.withDO(i.DO.Limit(limit)) } func (i intentRecordDo) Offset(offset int) IIntentRecordDo { return i.withDO(i.DO.Offset(offset)) } func (i intentRecordDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IIntentRecordDo { return i.withDO(i.DO.Scopes(funcs...)) } func (i intentRecordDo) Unscoped() IIntentRecordDo { return i.withDO(i.DO.Unscoped()) } func (i intentRecordDo) Create(values ...*model.IntentRecord) error { if len(values) == 0 { return nil } return i.DO.Create(values) } func (i intentRecordDo) CreateInBatches(values []*model.IntentRecord, batchSize int) error { return i.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 (i intentRecordDo) Save(values ...*model.IntentRecord) error { if len(values) == 0 { return nil } return i.DO.Save(values) } func (i intentRecordDo) First() (*model.IntentRecord, error) { if result, err := i.DO.First(); err != nil { return nil, err } else { return result.(*model.IntentRecord), nil } } func (i intentRecordDo) Take() (*model.IntentRecord, error) { if result, err := i.DO.Take(); err != nil { return nil, err } else { return result.(*model.IntentRecord), nil } } func (i intentRecordDo) Last() (*model.IntentRecord, error) { if result, err := i.DO.Last(); err != nil { return nil, err } else { return result.(*model.IntentRecord), nil } } func (i intentRecordDo) Find() ([]*model.IntentRecord, error) { result, err := i.DO.Find() return result.([]*model.IntentRecord), err } func (i intentRecordDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.IntentRecord, err error) { buf := make([]*model.IntentRecord, 0, batchSize) err = i.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 (i intentRecordDo) FindInBatches(result *[]*model.IntentRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error { return i.DO.FindInBatches(result, batchSize, fc) } func (i intentRecordDo) Attrs(attrs ...field.AssignExpr) IIntentRecordDo { return i.withDO(i.DO.Attrs(attrs...)) } func (i intentRecordDo) Assign(attrs ...field.AssignExpr) IIntentRecordDo { return i.withDO(i.DO.Assign(attrs...)) } func (i intentRecordDo) Joins(fields ...field.RelationField) IIntentRecordDo { for _, _f := range fields { i = *i.withDO(i.DO.Joins(_f)) } return &i } func (i intentRecordDo) Preload(fields ...field.RelationField) IIntentRecordDo { for _, _f := range fields { i = *i.withDO(i.DO.Preload(_f)) } return &i } func (i intentRecordDo) FirstOrInit() (*model.IntentRecord, error) { if result, err := i.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.IntentRecord), nil } } func (i intentRecordDo) FirstOrCreate() (*model.IntentRecord, error) { if result, err := i.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.IntentRecord), nil } } func (i intentRecordDo) FindByPage(offset int, limit int) (result []*model.IntentRecord, count int64, err error) { result, err = i.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 = i.Offset(-1).Limit(-1).Count() return } func (i intentRecordDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = i.Count() if err != nil { return } err = i.Offset(offset).Limit(limit).Scan(result) return } func (i intentRecordDo) Scan(result interface{}) (err error) { return i.DO.Scan(result) } func (i intentRecordDo) Delete(models ...*model.IntentRecord) (result gen.ResultInfo, err error) { return i.DO.Delete(models) } func (i *intentRecordDo) withDO(do gen.Dao) *intentRecordDo { i.DO = *do.(*gen.DO) return i }