// 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" "database/sql" "gorm.io/gorm" "gorm.io/gen" "gorm.io/plugin/dbresolver" ) var ( Q = new(Query) Agent *agent AliyunAvatar *aliyunAvatar AllocAgent *allocAgent BatchMsg *batchMsg BatchMsgCopy1 *batchMsgCopy1 Category *category ChatRecord *chatRecord ChatSession *chatSession Contact *contact CreditBalance *creditBalance CreditUsage *creditUsage Employee *employee EmployeeConfig *employeeConfig FormRecord *formRecord IntentOrg *intentOrg IntentRecord *intentRecord Label *label LabelRelationship *labelRelationship LabelTagging *labelTagging MessageRecord *messageRecord MismatchRecord *mismatchRecord Msg *msg PayRecharge *payRecharge Record *record Server *server SopNode *sopNode SopStage *sopStage SopTask *sopTask Token *token Tutorial *tutorial UsageDetail *usageDetail UsageStatisticDay *usageStatisticDay UsageStatisticHour *usageStatisticHour UsageStatisticMonth *usageStatisticMonth UsageTotal *usageTotal Whatsapp *whatsapp WhatsappChannel *whatsappChannel WorkExperience *workExperience WpChatroom *wpChatroom WpChatroomMember *wpChatroomMember Wx *wx WxCard *wxCard WxCardUser *wxCardUser WxCardVisit *wxCardVisit XunjiContact *xunjiContact ) func SetDefault(db *gorm.DB, opts ...gen.DOOption) { *Q = *Use(db, opts...) Agent = &Q.Agent AliyunAvatar = &Q.AliyunAvatar AllocAgent = &Q.AllocAgent BatchMsg = &Q.BatchMsg BatchMsgCopy1 = &Q.BatchMsgCopy1 Category = &Q.Category ChatRecord = &Q.ChatRecord ChatSession = &Q.ChatSession Contact = &Q.Contact CreditBalance = &Q.CreditBalance CreditUsage = &Q.CreditUsage Employee = &Q.Employee EmployeeConfig = &Q.EmployeeConfig FormRecord = &Q.FormRecord IntentOrg = &Q.IntentOrg IntentRecord = &Q.IntentRecord Label = &Q.Label LabelRelationship = &Q.LabelRelationship LabelTagging = &Q.LabelTagging MessageRecord = &Q.MessageRecord MismatchRecord = &Q.MismatchRecord Msg = &Q.Msg PayRecharge = &Q.PayRecharge Record = &Q.Record Server = &Q.Server SopNode = &Q.SopNode SopStage = &Q.SopStage SopTask = &Q.SopTask Token = &Q.Token Tutorial = &Q.Tutorial UsageDetail = &Q.UsageDetail UsageStatisticDay = &Q.UsageStatisticDay UsageStatisticHour = &Q.UsageStatisticHour UsageStatisticMonth = &Q.UsageStatisticMonth UsageTotal = &Q.UsageTotal Whatsapp = &Q.Whatsapp WhatsappChannel = &Q.WhatsappChannel WorkExperience = &Q.WorkExperience WpChatroom = &Q.WpChatroom WpChatroomMember = &Q.WpChatroomMember Wx = &Q.Wx WxCard = &Q.WxCard WxCardUser = &Q.WxCardUser WxCardVisit = &Q.WxCardVisit XunjiContact = &Q.XunjiContact } func Use(db *gorm.DB, opts ...gen.DOOption) *Query { return &Query{ db: db, Agent: newAgent(db, opts...), AliyunAvatar: newAliyunAvatar(db, opts...), AllocAgent: newAllocAgent(db, opts...), BatchMsg: newBatchMsg(db, opts...), BatchMsgCopy1: newBatchMsgCopy1(db, opts...), Category: newCategory(db, opts...), ChatRecord: newChatRecord(db, opts...), ChatSession: newChatSession(db, opts...), Contact: newContact(db, opts...), CreditBalance: newCreditBalance(db, opts...), CreditUsage: newCreditUsage(db, opts...), Employee: newEmployee(db, opts...), EmployeeConfig: newEmployeeConfig(db, opts...), FormRecord: newFormRecord(db, opts...), IntentOrg: newIntentOrg(db, opts...), IntentRecord: newIntentRecord(db, opts...), Label: newLabel(db, opts...), LabelRelationship: newLabelRelationship(db, opts...), LabelTagging: newLabelTagging(db, opts...), MessageRecord: newMessageRecord(db, opts...), MismatchRecord: newMismatchRecord(db, opts...), Msg: newMsg(db, opts...), PayRecharge: newPayRecharge(db, opts...), Record: newRecord(db, opts...), Server: newServer(db, opts...), SopNode: newSopNode(db, opts...), SopStage: newSopStage(db, opts...), SopTask: newSopTask(db, opts...), Token: newToken(db, opts...), Tutorial: newTutorial(db, opts...), UsageDetail: newUsageDetail(db, opts...), UsageStatisticDay: newUsageStatisticDay(db, opts...), UsageStatisticHour: newUsageStatisticHour(db, opts...), UsageStatisticMonth: newUsageStatisticMonth(db, opts...), UsageTotal: newUsageTotal(db, opts...), Whatsapp: newWhatsapp(db, opts...), WhatsappChannel: newWhatsappChannel(db, opts...), WorkExperience: newWorkExperience(db, opts...), WpChatroom: newWpChatroom(db, opts...), WpChatroomMember: newWpChatroomMember(db, opts...), Wx: newWx(db, opts...), WxCard: newWxCard(db, opts...), WxCardUser: newWxCardUser(db, opts...), WxCardVisit: newWxCardVisit(db, opts...), XunjiContact: newXunjiContact(db, opts...), } } type Query struct { db *gorm.DB Agent agent AliyunAvatar aliyunAvatar AllocAgent allocAgent BatchMsg batchMsg BatchMsgCopy1 batchMsgCopy1 Category category ChatRecord chatRecord ChatSession chatSession Contact contact CreditBalance creditBalance CreditUsage creditUsage Employee employee EmployeeConfig employeeConfig FormRecord formRecord IntentOrg intentOrg IntentRecord intentRecord Label label LabelRelationship labelRelationship LabelTagging labelTagging MessageRecord messageRecord MismatchRecord mismatchRecord Msg msg PayRecharge payRecharge Record record Server server SopNode sopNode SopStage sopStage SopTask sopTask Token token Tutorial tutorial UsageDetail usageDetail UsageStatisticDay usageStatisticDay UsageStatisticHour usageStatisticHour UsageStatisticMonth usageStatisticMonth UsageTotal usageTotal Whatsapp whatsapp WhatsappChannel whatsappChannel WorkExperience workExperience WpChatroom wpChatroom WpChatroomMember wpChatroomMember Wx wx WxCard wxCard WxCardUser wxCardUser WxCardVisit wxCardVisit XunjiContact xunjiContact } func (q *Query) Available() bool { return q.db != nil } func (q *Query) clone(db *gorm.DB) *Query { return &Query{ db: db, Agent: q.Agent.clone(db), AliyunAvatar: q.AliyunAvatar.clone(db), AllocAgent: q.AllocAgent.clone(db), BatchMsg: q.BatchMsg.clone(db), BatchMsgCopy1: q.BatchMsgCopy1.clone(db), Category: q.Category.clone(db), ChatRecord: q.ChatRecord.clone(db), ChatSession: q.ChatSession.clone(db), Contact: q.Contact.clone(db), CreditBalance: q.CreditBalance.clone(db), CreditUsage: q.CreditUsage.clone(db), Employee: q.Employee.clone(db), EmployeeConfig: q.EmployeeConfig.clone(db), FormRecord: q.FormRecord.clone(db), IntentOrg: q.IntentOrg.clone(db), IntentRecord: q.IntentRecord.clone(db), Label: q.Label.clone(db), LabelRelationship: q.LabelRelationship.clone(db), LabelTagging: q.LabelTagging.clone(db), MessageRecord: q.MessageRecord.clone(db), MismatchRecord: q.MismatchRecord.clone(db), Msg: q.Msg.clone(db), PayRecharge: q.PayRecharge.clone(db), Record: q.Record.clone(db), Server: q.Server.clone(db), SopNode: q.SopNode.clone(db), SopStage: q.SopStage.clone(db), SopTask: q.SopTask.clone(db), Token: q.Token.clone(db), Tutorial: q.Tutorial.clone(db), UsageDetail: q.UsageDetail.clone(db), UsageStatisticDay: q.UsageStatisticDay.clone(db), UsageStatisticHour: q.UsageStatisticHour.clone(db), UsageStatisticMonth: q.UsageStatisticMonth.clone(db), UsageTotal: q.UsageTotal.clone(db), Whatsapp: q.Whatsapp.clone(db), WhatsappChannel: q.WhatsappChannel.clone(db), WorkExperience: q.WorkExperience.clone(db), WpChatroom: q.WpChatroom.clone(db), WpChatroomMember: q.WpChatroomMember.clone(db), Wx: q.Wx.clone(db), WxCard: q.WxCard.clone(db), WxCardUser: q.WxCardUser.clone(db), WxCardVisit: q.WxCardVisit.clone(db), XunjiContact: q.XunjiContact.clone(db), } } func (q *Query) ReadDB() *Query { return q.ReplaceDB(q.db.Clauses(dbresolver.Read)) } func (q *Query) WriteDB() *Query { return q.ReplaceDB(q.db.Clauses(dbresolver.Write)) } func (q *Query) ReplaceDB(db *gorm.DB) *Query { return &Query{ db: db, Agent: q.Agent.replaceDB(db), AliyunAvatar: q.AliyunAvatar.replaceDB(db), AllocAgent: q.AllocAgent.replaceDB(db), BatchMsg: q.BatchMsg.replaceDB(db), BatchMsgCopy1: q.BatchMsgCopy1.replaceDB(db), Category: q.Category.replaceDB(db), ChatRecord: q.ChatRecord.replaceDB(db), ChatSession: q.ChatSession.replaceDB(db), Contact: q.Contact.replaceDB(db), CreditBalance: q.CreditBalance.replaceDB(db), CreditUsage: q.CreditUsage.replaceDB(db), Employee: q.Employee.replaceDB(db), EmployeeConfig: q.EmployeeConfig.replaceDB(db), FormRecord: q.FormRecord.replaceDB(db), IntentOrg: q.IntentOrg.replaceDB(db), IntentRecord: q.IntentRecord.replaceDB(db), Label: q.Label.replaceDB(db), LabelRelationship: q.LabelRelationship.replaceDB(db), LabelTagging: q.LabelTagging.replaceDB(db), MessageRecord: q.MessageRecord.replaceDB(db), MismatchRecord: q.MismatchRecord.replaceDB(db), Msg: q.Msg.replaceDB(db), PayRecharge: q.PayRecharge.replaceDB(db), Record: q.Record.replaceDB(db), Server: q.Server.replaceDB(db), SopNode: q.SopNode.replaceDB(db), SopStage: q.SopStage.replaceDB(db), SopTask: q.SopTask.replaceDB(db), Token: q.Token.replaceDB(db), Tutorial: q.Tutorial.replaceDB(db), UsageDetail: q.UsageDetail.replaceDB(db), UsageStatisticDay: q.UsageStatisticDay.replaceDB(db), UsageStatisticHour: q.UsageStatisticHour.replaceDB(db), UsageStatisticMonth: q.UsageStatisticMonth.replaceDB(db), UsageTotal: q.UsageTotal.replaceDB(db), Whatsapp: q.Whatsapp.replaceDB(db), WhatsappChannel: q.WhatsappChannel.replaceDB(db), WorkExperience: q.WorkExperience.replaceDB(db), WpChatroom: q.WpChatroom.replaceDB(db), WpChatroomMember: q.WpChatroomMember.replaceDB(db), Wx: q.Wx.replaceDB(db), WxCard: q.WxCard.replaceDB(db), WxCardUser: q.WxCardUser.replaceDB(db), WxCardVisit: q.WxCardVisit.replaceDB(db), XunjiContact: q.XunjiContact.replaceDB(db), } } type queryCtx struct { Agent IAgentDo AliyunAvatar IAliyunAvatarDo AllocAgent IAllocAgentDo BatchMsg IBatchMsgDo BatchMsgCopy1 IBatchMsgCopy1Do Category ICategoryDo ChatRecord IChatRecordDo ChatSession IChatSessionDo Contact IContactDo CreditBalance ICreditBalanceDo CreditUsage ICreditUsageDo Employee IEmployeeDo EmployeeConfig IEmployeeConfigDo FormRecord IFormRecordDo IntentOrg IIntentOrgDo IntentRecord IIntentRecordDo Label ILabelDo LabelRelationship ILabelRelationshipDo LabelTagging ILabelTaggingDo MessageRecord IMessageRecordDo MismatchRecord IMismatchRecordDo Msg IMsgDo PayRecharge IPayRechargeDo Record IRecordDo Server IServerDo SopNode ISopNodeDo SopStage ISopStageDo SopTask ISopTaskDo Token ITokenDo Tutorial ITutorialDo UsageDetail IUsageDetailDo UsageStatisticDay IUsageStatisticDayDo UsageStatisticHour IUsageStatisticHourDo UsageStatisticMonth IUsageStatisticMonthDo UsageTotal IUsageTotalDo Whatsapp IWhatsappDo WhatsappChannel IWhatsappChannelDo WorkExperience IWorkExperienceDo WpChatroom IWpChatroomDo WpChatroomMember IWpChatroomMemberDo Wx IWxDo WxCard IWxCardDo WxCardUser IWxCardUserDo WxCardVisit IWxCardVisitDo XunjiContact IXunjiContactDo } func (q *Query) WithContext(ctx context.Context) *queryCtx { return &queryCtx{ Agent: q.Agent.WithContext(ctx), AliyunAvatar: q.AliyunAvatar.WithContext(ctx), AllocAgent: q.AllocAgent.WithContext(ctx), BatchMsg: q.BatchMsg.WithContext(ctx), BatchMsgCopy1: q.BatchMsgCopy1.WithContext(ctx), Category: q.Category.WithContext(ctx), ChatRecord: q.ChatRecord.WithContext(ctx), ChatSession: q.ChatSession.WithContext(ctx), Contact: q.Contact.WithContext(ctx), CreditBalance: q.CreditBalance.WithContext(ctx), CreditUsage: q.CreditUsage.WithContext(ctx), Employee: q.Employee.WithContext(ctx), EmployeeConfig: q.EmployeeConfig.WithContext(ctx), FormRecord: q.FormRecord.WithContext(ctx), IntentOrg: q.IntentOrg.WithContext(ctx), IntentRecord: q.IntentRecord.WithContext(ctx), Label: q.Label.WithContext(ctx), LabelRelationship: q.LabelRelationship.WithContext(ctx), LabelTagging: q.LabelTagging.WithContext(ctx), MessageRecord: q.MessageRecord.WithContext(ctx), MismatchRecord: q.MismatchRecord.WithContext(ctx), Msg: q.Msg.WithContext(ctx), PayRecharge: q.PayRecharge.WithContext(ctx), Record: q.Record.WithContext(ctx), Server: q.Server.WithContext(ctx), SopNode: q.SopNode.WithContext(ctx), SopStage: q.SopStage.WithContext(ctx), SopTask: q.SopTask.WithContext(ctx), Token: q.Token.WithContext(ctx), Tutorial: q.Tutorial.WithContext(ctx), UsageDetail: q.UsageDetail.WithContext(ctx), UsageStatisticDay: q.UsageStatisticDay.WithContext(ctx), UsageStatisticHour: q.UsageStatisticHour.WithContext(ctx), UsageStatisticMonth: q.UsageStatisticMonth.WithContext(ctx), UsageTotal: q.UsageTotal.WithContext(ctx), Whatsapp: q.Whatsapp.WithContext(ctx), WhatsappChannel: q.WhatsappChannel.WithContext(ctx), WorkExperience: q.WorkExperience.WithContext(ctx), WpChatroom: q.WpChatroom.WithContext(ctx), WpChatroomMember: q.WpChatroomMember.WithContext(ctx), Wx: q.Wx.WithContext(ctx), WxCard: q.WxCard.WithContext(ctx), WxCardUser: q.WxCardUser.WithContext(ctx), WxCardVisit: q.WxCardVisit.WithContext(ctx), XunjiContact: q.XunjiContact.WithContext(ctx), } } func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error { return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...) } func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx { tx := q.db.Begin(opts...) return &QueryTx{Query: q.clone(tx), Error: tx.Error} } type QueryTx struct { *Query Error error } func (q *QueryTx) Commit() error { return q.db.Commit().Error } func (q *QueryTx) Rollback() error { return q.db.Rollback().Error } func (q *QueryTx) SavePoint(name string) error { return q.db.SavePoint(name).Error } func (q *QueryTx) RollbackTo(name string) error { return q.db.RollbackTo(name).Error }