draft grpc
This commit is contained in:
427
internal/database/query/video_ad_configs.gen.go
Normal file
427
internal/database/query/video_ad_configs.gen.go
Normal file
@@ -0,0 +1,427 @@
|
||||
// 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/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"stream.api/internal/database/model"
|
||||
)
|
||||
|
||||
func newVideoAdConfig(db *gorm.DB, opts ...gen.DOOption) videoAdConfig {
|
||||
_videoAdConfig := videoAdConfig{}
|
||||
|
||||
_videoAdConfig.videoAdConfigDo.UseDB(db, opts...)
|
||||
_videoAdConfig.videoAdConfigDo.UseModel(&model.VideoAdConfig{})
|
||||
|
||||
tableName := _videoAdConfig.videoAdConfigDo.TableName()
|
||||
_videoAdConfig.ALL = field.NewAsterisk(tableName)
|
||||
_videoAdConfig.VideoID = field.NewString(tableName, "video_id")
|
||||
_videoAdConfig.UserID = field.NewString(tableName, "user_id")
|
||||
_videoAdConfig.AdTemplateID = field.NewString(tableName, "ad_template_id")
|
||||
_videoAdConfig.VastTagURL = field.NewString(tableName, "vast_tag_url")
|
||||
_videoAdConfig.AdFormat = field.NewString(tableName, "ad_format")
|
||||
_videoAdConfig.Duration = field.NewInt64(tableName, "duration")
|
||||
_videoAdConfig.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_videoAdConfig.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_videoAdConfig.Version = field.NewInt64(tableName, "version")
|
||||
|
||||
_videoAdConfig.fillFieldMap()
|
||||
|
||||
return _videoAdConfig
|
||||
}
|
||||
|
||||
type videoAdConfig struct {
|
||||
videoAdConfigDo videoAdConfigDo
|
||||
|
||||
ALL field.Asterisk
|
||||
VideoID field.String
|
||||
UserID field.String
|
||||
AdTemplateID field.String
|
||||
VastTagURL field.String
|
||||
AdFormat field.String
|
||||
Duration field.Int64
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
Version field.Int64
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (v videoAdConfig) Table(newTableName string) *videoAdConfig {
|
||||
v.videoAdConfigDo.UseTable(newTableName)
|
||||
return v.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (v videoAdConfig) As(alias string) *videoAdConfig {
|
||||
v.videoAdConfigDo.DO = *(v.videoAdConfigDo.As(alias).(*gen.DO))
|
||||
return v.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (v *videoAdConfig) updateTableName(table string) *videoAdConfig {
|
||||
v.ALL = field.NewAsterisk(table)
|
||||
v.VideoID = field.NewString(table, "video_id")
|
||||
v.UserID = field.NewString(table, "user_id")
|
||||
v.AdTemplateID = field.NewString(table, "ad_template_id")
|
||||
v.VastTagURL = field.NewString(table, "vast_tag_url")
|
||||
v.AdFormat = field.NewString(table, "ad_format")
|
||||
v.Duration = field.NewInt64(table, "duration")
|
||||
v.CreatedAt = field.NewTime(table, "created_at")
|
||||
v.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
v.Version = field.NewInt64(table, "version")
|
||||
|
||||
v.fillFieldMap()
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *videoAdConfig) WithContext(ctx context.Context) IVideoAdConfigDo {
|
||||
return v.videoAdConfigDo.WithContext(ctx)
|
||||
}
|
||||
|
||||
func (v videoAdConfig) TableName() string { return v.videoAdConfigDo.TableName() }
|
||||
|
||||
func (v videoAdConfig) Alias() string { return v.videoAdConfigDo.Alias() }
|
||||
|
||||
func (v videoAdConfig) Columns(cols ...field.Expr) gen.Columns {
|
||||
return v.videoAdConfigDo.Columns(cols...)
|
||||
}
|
||||
|
||||
func (v *videoAdConfig) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := v.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (v *videoAdConfig) fillFieldMap() {
|
||||
v.fieldMap = make(map[string]field.Expr, 9)
|
||||
v.fieldMap["video_id"] = v.VideoID
|
||||
v.fieldMap["user_id"] = v.UserID
|
||||
v.fieldMap["ad_template_id"] = v.AdTemplateID
|
||||
v.fieldMap["vast_tag_url"] = v.VastTagURL
|
||||
v.fieldMap["ad_format"] = v.AdFormat
|
||||
v.fieldMap["duration"] = v.Duration
|
||||
v.fieldMap["created_at"] = v.CreatedAt
|
||||
v.fieldMap["updated_at"] = v.UpdatedAt
|
||||
v.fieldMap["version"] = v.Version
|
||||
}
|
||||
|
||||
func (v videoAdConfig) clone(db *gorm.DB) videoAdConfig {
|
||||
v.videoAdConfigDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return v
|
||||
}
|
||||
|
||||
func (v videoAdConfig) replaceDB(db *gorm.DB) videoAdConfig {
|
||||
v.videoAdConfigDo.ReplaceDB(db)
|
||||
return v
|
||||
}
|
||||
|
||||
type videoAdConfigDo struct{ gen.DO }
|
||||
|
||||
type IVideoAdConfigDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IVideoAdConfigDo
|
||||
WithContext(ctx context.Context) IVideoAdConfigDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IVideoAdConfigDo
|
||||
WriteDB() IVideoAdConfigDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IVideoAdConfigDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IVideoAdConfigDo
|
||||
Not(conds ...gen.Condition) IVideoAdConfigDo
|
||||
Or(conds ...gen.Condition) IVideoAdConfigDo
|
||||
Select(conds ...field.Expr) IVideoAdConfigDo
|
||||
Where(conds ...gen.Condition) IVideoAdConfigDo
|
||||
Order(conds ...field.Expr) IVideoAdConfigDo
|
||||
Distinct(cols ...field.Expr) IVideoAdConfigDo
|
||||
Omit(cols ...field.Expr) IVideoAdConfigDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IVideoAdConfigDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IVideoAdConfigDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IVideoAdConfigDo
|
||||
Group(cols ...field.Expr) IVideoAdConfigDo
|
||||
Having(conds ...gen.Condition) IVideoAdConfigDo
|
||||
Limit(limit int) IVideoAdConfigDo
|
||||
Offset(offset int) IVideoAdConfigDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IVideoAdConfigDo
|
||||
Unscoped() IVideoAdConfigDo
|
||||
Create(values ...*model.VideoAdConfig) error
|
||||
CreateInBatches(values []*model.VideoAdConfig, batchSize int) error
|
||||
Save(values ...*model.VideoAdConfig) error
|
||||
First() (*model.VideoAdConfig, error)
|
||||
Take() (*model.VideoAdConfig, error)
|
||||
Last() (*model.VideoAdConfig, error)
|
||||
Find() ([]*model.VideoAdConfig, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.VideoAdConfig, err error)
|
||||
FindInBatches(result *[]*model.VideoAdConfig, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.VideoAdConfig) (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) IVideoAdConfigDo
|
||||
Assign(attrs ...field.AssignExpr) IVideoAdConfigDo
|
||||
Joins(fields ...field.RelationField) IVideoAdConfigDo
|
||||
Preload(fields ...field.RelationField) IVideoAdConfigDo
|
||||
FirstOrInit() (*model.VideoAdConfig, error)
|
||||
FirstOrCreate() (*model.VideoAdConfig, error)
|
||||
FindByPage(offset int, limit int) (result []*model.VideoAdConfig, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Rows() (*sql.Rows, error)
|
||||
Row() *sql.Row
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IVideoAdConfigDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Debug() IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Debug())
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) WithContext(ctx context.Context) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) ReadDB() IVideoAdConfigDo {
|
||||
return v.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) WriteDB() IVideoAdConfigDo {
|
||||
return v.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Session(config *gorm.Session) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Session(config))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Clauses(conds ...clause.Expression) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Returning(value interface{}, columns ...string) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Not(conds ...gen.Condition) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Or(conds ...gen.Condition) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Select(conds ...field.Expr) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Where(conds ...gen.Condition) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Order(conds ...field.Expr) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Distinct(cols ...field.Expr) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Omit(cols ...field.Expr) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Join(table schema.Tabler, on ...field.Expr) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) LeftJoin(table schema.Tabler, on ...field.Expr) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) RightJoin(table schema.Tabler, on ...field.Expr) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Group(cols ...field.Expr) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Having(conds ...gen.Condition) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Limit(limit int) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Offset(offset int) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Unscoped() IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Create(values ...*model.VideoAdConfig) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return v.DO.Create(values)
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) CreateInBatches(values []*model.VideoAdConfig, batchSize int) error {
|
||||
return v.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 (v videoAdConfigDo) Save(values ...*model.VideoAdConfig) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return v.DO.Save(values)
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) First() (*model.VideoAdConfig, error) {
|
||||
if result, err := v.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.VideoAdConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Take() (*model.VideoAdConfig, error) {
|
||||
if result, err := v.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.VideoAdConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Last() (*model.VideoAdConfig, error) {
|
||||
if result, err := v.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.VideoAdConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Find() ([]*model.VideoAdConfig, error) {
|
||||
result, err := v.DO.Find()
|
||||
return result.([]*model.VideoAdConfig), err
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.VideoAdConfig, err error) {
|
||||
buf := make([]*model.VideoAdConfig, 0, batchSize)
|
||||
err = v.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 (v videoAdConfigDo) FindInBatches(result *[]*model.VideoAdConfig, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return v.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Attrs(attrs ...field.AssignExpr) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Assign(attrs ...field.AssignExpr) IVideoAdConfigDo {
|
||||
return v.withDO(v.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Joins(fields ...field.RelationField) IVideoAdConfigDo {
|
||||
for _, _f := range fields {
|
||||
v = *v.withDO(v.DO.Joins(_f))
|
||||
}
|
||||
return &v
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Preload(fields ...field.RelationField) IVideoAdConfigDo {
|
||||
for _, _f := range fields {
|
||||
v = *v.withDO(v.DO.Preload(_f))
|
||||
}
|
||||
return &v
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) FirstOrInit() (*model.VideoAdConfig, error) {
|
||||
if result, err := v.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.VideoAdConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) FirstOrCreate() (*model.VideoAdConfig, error) {
|
||||
if result, err := v.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.VideoAdConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) FindByPage(offset int, limit int) (result []*model.VideoAdConfig, count int64, err error) {
|
||||
result, err = v.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 = v.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = v.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = v.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Scan(result interface{}) (err error) {
|
||||
return v.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (v videoAdConfigDo) Delete(models ...*model.VideoAdConfig) (result gen.ResultInfo, err error) {
|
||||
return v.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (v *videoAdConfigDo) withDO(do gen.Dao) *videoAdConfigDo {
|
||||
v.DO = *do.(*gen.DO)
|
||||
return v
|
||||
}
|
||||
Reference in New Issue
Block a user