123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 |
- // 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 newBatchMsgCopy1(db *gorm.DB, opts ...gen.DOOption) batchMsgCopy1 {
- _batchMsgCopy1 := batchMsgCopy1{}
- _batchMsgCopy1.batchMsgCopy1Do.UseDB(db, opts...)
- _batchMsgCopy1.batchMsgCopy1Do.UseModel(&model.BatchMsgCopy1{})
- tableName := _batchMsgCopy1.batchMsgCopy1Do.TableName()
- _batchMsgCopy1.ALL = field.NewAsterisk(tableName)
- _batchMsgCopy1.ID = field.NewInt64(tableName, "id")
- _batchMsgCopy1.CreatedAt = field.NewTime(tableName, "created_at")
- _batchMsgCopy1.UpdatedAt = field.NewTime(tableName, "updated_at")
- _batchMsgCopy1.DeletedAt = field.NewField(tableName, "deleted_at")
- _batchMsgCopy1.Status = field.NewInt64(tableName, "status")
- _batchMsgCopy1.BatchNo = field.NewString(tableName, "batch_no")
- _batchMsgCopy1.Fromwxid = field.NewString(tableName, "fromwxid")
- _batchMsgCopy1.Msg = field.NewString(tableName, "msg")
- _batchMsgCopy1.Tag = field.NewString(tableName, "tag")
- _batchMsgCopy1.Total = field.NewInt64(tableName, "total")
- _batchMsgCopy1.Success = field.NewInt64(tableName, "success")
- _batchMsgCopy1.Fail = field.NewInt64(tableName, "fail")
- _batchMsgCopy1.StartTime = field.NewTime(tableName, "start_time")
- _batchMsgCopy1.StopTime = field.NewTime(tableName, "stop_time")
- _batchMsgCopy1.fillFieldMap()
- return _batchMsgCopy1
- }
- // batchMsgCopy1 批量消息表
- type batchMsgCopy1 struct {
- batchMsgCopy1Do
- ALL field.Asterisk
- ID field.Int64
- CreatedAt field.Time // Create Time | 创建日期
- UpdatedAt field.Time // Update Time | 修改日期
- DeletedAt field.Field // Delete Time | 删除日期
- Status field.Int64 // 状态 0 未开始 1 发送中 2 发送完成 3 发送中止
- BatchNo field.String // 批次号
- Fromwxid field.String // 发送方微信ID
- Msg field.String // 内容
- Tag field.String // 发送规则 all 全部 tag1,tag2 按tag发送
- Total field.Int64 // 总数
- Success field.Int64 // 成功数量
- Fail field.Int64 // 失败数量
- StartTime field.Time // 开始时间
- StopTime field.Time // 结束时间
- fieldMap map[string]field.Expr
- }
- func (b batchMsgCopy1) Table(newTableName string) *batchMsgCopy1 {
- b.batchMsgCopy1Do.UseTable(newTableName)
- return b.updateTableName(newTableName)
- }
- func (b batchMsgCopy1) As(alias string) *batchMsgCopy1 {
- b.batchMsgCopy1Do.DO = *(b.batchMsgCopy1Do.As(alias).(*gen.DO))
- return b.updateTableName(alias)
- }
- func (b *batchMsgCopy1) updateTableName(table string) *batchMsgCopy1 {
- b.ALL = field.NewAsterisk(table)
- b.ID = field.NewInt64(table, "id")
- b.CreatedAt = field.NewTime(table, "created_at")
- b.UpdatedAt = field.NewTime(table, "updated_at")
- b.DeletedAt = field.NewField(table, "deleted_at")
- b.Status = field.NewInt64(table, "status")
- b.BatchNo = field.NewString(table, "batch_no")
- b.Fromwxid = field.NewString(table, "fromwxid")
- b.Msg = field.NewString(table, "msg")
- b.Tag = field.NewString(table, "tag")
- b.Total = field.NewInt64(table, "total")
- b.Success = field.NewInt64(table, "success")
- b.Fail = field.NewInt64(table, "fail")
- b.StartTime = field.NewTime(table, "start_time")
- b.StopTime = field.NewTime(table, "stop_time")
- b.fillFieldMap()
- return b
- }
- func (b *batchMsgCopy1) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
- _f, ok := b.fieldMap[fieldName]
- if !ok || _f == nil {
- return nil, false
- }
- _oe, ok := _f.(field.OrderExpr)
- return _oe, ok
- }
- func (b *batchMsgCopy1) fillFieldMap() {
- b.fieldMap = make(map[string]field.Expr, 14)
- b.fieldMap["id"] = b.ID
- b.fieldMap["created_at"] = b.CreatedAt
- b.fieldMap["updated_at"] = b.UpdatedAt
- b.fieldMap["deleted_at"] = b.DeletedAt
- b.fieldMap["status"] = b.Status
- b.fieldMap["batch_no"] = b.BatchNo
- b.fieldMap["fromwxid"] = b.Fromwxid
- b.fieldMap["msg"] = b.Msg
- b.fieldMap["tag"] = b.Tag
- b.fieldMap["total"] = b.Total
- b.fieldMap["success"] = b.Success
- b.fieldMap["fail"] = b.Fail
- b.fieldMap["start_time"] = b.StartTime
- b.fieldMap["stop_time"] = b.StopTime
- }
- func (b batchMsgCopy1) clone(db *gorm.DB) batchMsgCopy1 {
- b.batchMsgCopy1Do.ReplaceConnPool(db.Statement.ConnPool)
- return b
- }
- func (b batchMsgCopy1) replaceDB(db *gorm.DB) batchMsgCopy1 {
- b.batchMsgCopy1Do.ReplaceDB(db)
- return b
- }
- type batchMsgCopy1Do struct{ gen.DO }
- type IBatchMsgCopy1Do interface {
- gen.SubQuery
- Debug() IBatchMsgCopy1Do
- WithContext(ctx context.Context) IBatchMsgCopy1Do
- WithResult(fc func(tx gen.Dao)) gen.ResultInfo
- ReplaceDB(db *gorm.DB)
- ReadDB() IBatchMsgCopy1Do
- WriteDB() IBatchMsgCopy1Do
- As(alias string) gen.Dao
- Session(config *gorm.Session) IBatchMsgCopy1Do
- Columns(cols ...field.Expr) gen.Columns
- Clauses(conds ...clause.Expression) IBatchMsgCopy1Do
- Not(conds ...gen.Condition) IBatchMsgCopy1Do
- Or(conds ...gen.Condition) IBatchMsgCopy1Do
- Select(conds ...field.Expr) IBatchMsgCopy1Do
- Where(conds ...gen.Condition) IBatchMsgCopy1Do
- Order(conds ...field.Expr) IBatchMsgCopy1Do
- Distinct(cols ...field.Expr) IBatchMsgCopy1Do
- Omit(cols ...field.Expr) IBatchMsgCopy1Do
- Join(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do
- LeftJoin(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do
- RightJoin(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do
- Group(cols ...field.Expr) IBatchMsgCopy1Do
- Having(conds ...gen.Condition) IBatchMsgCopy1Do
- Limit(limit int) IBatchMsgCopy1Do
- Offset(offset int) IBatchMsgCopy1Do
- Count() (count int64, err error)
- Scopes(funcs ...func(gen.Dao) gen.Dao) IBatchMsgCopy1Do
- Unscoped() IBatchMsgCopy1Do
- Create(values ...*model.BatchMsgCopy1) error
- CreateInBatches(values []*model.BatchMsgCopy1, batchSize int) error
- Save(values ...*model.BatchMsgCopy1) error
- First() (*model.BatchMsgCopy1, error)
- Take() (*model.BatchMsgCopy1, error)
- Last() (*model.BatchMsgCopy1, error)
- Find() ([]*model.BatchMsgCopy1, error)
- FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.BatchMsgCopy1, err error)
- FindInBatches(result *[]*model.BatchMsgCopy1, batchSize int, fc func(tx gen.Dao, batch int) error) error
- Pluck(column field.Expr, dest interface{}) error
- Delete(...*model.BatchMsgCopy1) (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) IBatchMsgCopy1Do
- Assign(attrs ...field.AssignExpr) IBatchMsgCopy1Do
- Joins(fields ...field.RelationField) IBatchMsgCopy1Do
- Preload(fields ...field.RelationField) IBatchMsgCopy1Do
- FirstOrInit() (*model.BatchMsgCopy1, error)
- FirstOrCreate() (*model.BatchMsgCopy1, error)
- FindByPage(offset int, limit int) (result []*model.BatchMsgCopy1, 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) IBatchMsgCopy1Do
- UnderlyingDB() *gorm.DB
- schema.Tabler
- }
- func (b batchMsgCopy1Do) Debug() IBatchMsgCopy1Do {
- return b.withDO(b.DO.Debug())
- }
- func (b batchMsgCopy1Do) WithContext(ctx context.Context) IBatchMsgCopy1Do {
- return b.withDO(b.DO.WithContext(ctx))
- }
- func (b batchMsgCopy1Do) ReadDB() IBatchMsgCopy1Do {
- return b.Clauses(dbresolver.Read)
- }
- func (b batchMsgCopy1Do) WriteDB() IBatchMsgCopy1Do {
- return b.Clauses(dbresolver.Write)
- }
- func (b batchMsgCopy1Do) Session(config *gorm.Session) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Session(config))
- }
- func (b batchMsgCopy1Do) Clauses(conds ...clause.Expression) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Clauses(conds...))
- }
- func (b batchMsgCopy1Do) Returning(value interface{}, columns ...string) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Returning(value, columns...))
- }
- func (b batchMsgCopy1Do) Not(conds ...gen.Condition) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Not(conds...))
- }
- func (b batchMsgCopy1Do) Or(conds ...gen.Condition) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Or(conds...))
- }
- func (b batchMsgCopy1Do) Select(conds ...field.Expr) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Select(conds...))
- }
- func (b batchMsgCopy1Do) Where(conds ...gen.Condition) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Where(conds...))
- }
- func (b batchMsgCopy1Do) Order(conds ...field.Expr) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Order(conds...))
- }
- func (b batchMsgCopy1Do) Distinct(cols ...field.Expr) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Distinct(cols...))
- }
- func (b batchMsgCopy1Do) Omit(cols ...field.Expr) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Omit(cols...))
- }
- func (b batchMsgCopy1Do) Join(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Join(table, on...))
- }
- func (b batchMsgCopy1Do) LeftJoin(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do {
- return b.withDO(b.DO.LeftJoin(table, on...))
- }
- func (b batchMsgCopy1Do) RightJoin(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do {
- return b.withDO(b.DO.RightJoin(table, on...))
- }
- func (b batchMsgCopy1Do) Group(cols ...field.Expr) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Group(cols...))
- }
- func (b batchMsgCopy1Do) Having(conds ...gen.Condition) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Having(conds...))
- }
- func (b batchMsgCopy1Do) Limit(limit int) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Limit(limit))
- }
- func (b batchMsgCopy1Do) Offset(offset int) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Offset(offset))
- }
- func (b batchMsgCopy1Do) Scopes(funcs ...func(gen.Dao) gen.Dao) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Scopes(funcs...))
- }
- func (b batchMsgCopy1Do) Unscoped() IBatchMsgCopy1Do {
- return b.withDO(b.DO.Unscoped())
- }
- func (b batchMsgCopy1Do) Create(values ...*model.BatchMsgCopy1) error {
- if len(values) == 0 {
- return nil
- }
- return b.DO.Create(values)
- }
- func (b batchMsgCopy1Do) CreateInBatches(values []*model.BatchMsgCopy1, batchSize int) error {
- return b.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 (b batchMsgCopy1Do) Save(values ...*model.BatchMsgCopy1) error {
- if len(values) == 0 {
- return nil
- }
- return b.DO.Save(values)
- }
- func (b batchMsgCopy1Do) First() (*model.BatchMsgCopy1, error) {
- if result, err := b.DO.First(); err != nil {
- return nil, err
- } else {
- return result.(*model.BatchMsgCopy1), nil
- }
- }
- func (b batchMsgCopy1Do) Take() (*model.BatchMsgCopy1, error) {
- if result, err := b.DO.Take(); err != nil {
- return nil, err
- } else {
- return result.(*model.BatchMsgCopy1), nil
- }
- }
- func (b batchMsgCopy1Do) Last() (*model.BatchMsgCopy1, error) {
- if result, err := b.DO.Last(); err != nil {
- return nil, err
- } else {
- return result.(*model.BatchMsgCopy1), nil
- }
- }
- func (b batchMsgCopy1Do) Find() ([]*model.BatchMsgCopy1, error) {
- result, err := b.DO.Find()
- return result.([]*model.BatchMsgCopy1), err
- }
- func (b batchMsgCopy1Do) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.BatchMsgCopy1, err error) {
- buf := make([]*model.BatchMsgCopy1, 0, batchSize)
- err = b.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 (b batchMsgCopy1Do) FindInBatches(result *[]*model.BatchMsgCopy1, batchSize int, fc func(tx gen.Dao, batch int) error) error {
- return b.DO.FindInBatches(result, batchSize, fc)
- }
- func (b batchMsgCopy1Do) Attrs(attrs ...field.AssignExpr) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Attrs(attrs...))
- }
- func (b batchMsgCopy1Do) Assign(attrs ...field.AssignExpr) IBatchMsgCopy1Do {
- return b.withDO(b.DO.Assign(attrs...))
- }
- func (b batchMsgCopy1Do) Joins(fields ...field.RelationField) IBatchMsgCopy1Do {
- for _, _f := range fields {
- b = *b.withDO(b.DO.Joins(_f))
- }
- return &b
- }
- func (b batchMsgCopy1Do) Preload(fields ...field.RelationField) IBatchMsgCopy1Do {
- for _, _f := range fields {
- b = *b.withDO(b.DO.Preload(_f))
- }
- return &b
- }
- func (b batchMsgCopy1Do) FirstOrInit() (*model.BatchMsgCopy1, error) {
- if result, err := b.DO.FirstOrInit(); err != nil {
- return nil, err
- } else {
- return result.(*model.BatchMsgCopy1), nil
- }
- }
- func (b batchMsgCopy1Do) FirstOrCreate() (*model.BatchMsgCopy1, error) {
- if result, err := b.DO.FirstOrCreate(); err != nil {
- return nil, err
- } else {
- return result.(*model.BatchMsgCopy1), nil
- }
- }
- func (b batchMsgCopy1Do) FindByPage(offset int, limit int) (result []*model.BatchMsgCopy1, count int64, err error) {
- result, err = b.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 = b.Offset(-1).Limit(-1).Count()
- return
- }
- func (b batchMsgCopy1Do) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
- count, err = b.Count()
- if err != nil {
- return
- }
- err = b.Offset(offset).Limit(limit).Scan(result)
- return
- }
- func (b batchMsgCopy1Do) Scan(result interface{}) (err error) {
- return b.DO.Scan(result)
- }
- func (b batchMsgCopy1Do) Delete(models ...*model.BatchMsgCopy1) (result gen.ResultInfo, err error) {
- return b.DO.Delete(models)
- }
- func (b *batchMsgCopy1Do) withDO(do gen.Dao) *batchMsgCopy1Do {
- b.DO = *do.(*gen.DO)
- return b
- }
|