feat: manually mirror opencoze's code from bytedance
Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
@@ -0,0 +1,405 @@
|
||||
// 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"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/app/internal/dal/model"
|
||||
)
|
||||
|
||||
func newAppConnectorReleaseRef(db *gorm.DB, opts ...gen.DOOption) appConnectorReleaseRef {
|
||||
_appConnectorReleaseRef := appConnectorReleaseRef{}
|
||||
|
||||
_appConnectorReleaseRef.appConnectorReleaseRefDo.UseDB(db, opts...)
|
||||
_appConnectorReleaseRef.appConnectorReleaseRefDo.UseModel(&model.AppConnectorReleaseRef{})
|
||||
|
||||
tableName := _appConnectorReleaseRef.appConnectorReleaseRefDo.TableName()
|
||||
_appConnectorReleaseRef.ALL = field.NewAsterisk(tableName)
|
||||
_appConnectorReleaseRef.ID = field.NewInt64(tableName, "id")
|
||||
_appConnectorReleaseRef.RecordID = field.NewInt64(tableName, "record_id")
|
||||
_appConnectorReleaseRef.ConnectorID = field.NewInt64(tableName, "connector_id")
|
||||
_appConnectorReleaseRef.PublishConfig = field.NewField(tableName, "publish_config")
|
||||
_appConnectorReleaseRef.PublishStatus = field.NewInt32(tableName, "publish_status")
|
||||
_appConnectorReleaseRef.CreatedAt = field.NewInt64(tableName, "created_at")
|
||||
_appConnectorReleaseRef.UpdatedAt = field.NewInt64(tableName, "updated_at")
|
||||
|
||||
_appConnectorReleaseRef.fillFieldMap()
|
||||
|
||||
return _appConnectorReleaseRef
|
||||
}
|
||||
|
||||
// appConnectorReleaseRef Connector Release Record Reference
|
||||
type appConnectorReleaseRef struct {
|
||||
appConnectorReleaseRefDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // Primary Key
|
||||
RecordID field.Int64 // Publish Record ID
|
||||
ConnectorID field.Int64 // Publish Connector ID
|
||||
PublishConfig field.Field // Publish Configuration
|
||||
PublishStatus field.Int32 // Publish Status
|
||||
CreatedAt field.Int64 // Create Time in Milliseconds
|
||||
UpdatedAt field.Int64 // Update Time in Milliseconds
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRef) Table(newTableName string) *appConnectorReleaseRef {
|
||||
a.appConnectorReleaseRefDo.UseTable(newTableName)
|
||||
return a.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRef) As(alias string) *appConnectorReleaseRef {
|
||||
a.appConnectorReleaseRefDo.DO = *(a.appConnectorReleaseRefDo.As(alias).(*gen.DO))
|
||||
return a.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (a *appConnectorReleaseRef) updateTableName(table string) *appConnectorReleaseRef {
|
||||
a.ALL = field.NewAsterisk(table)
|
||||
a.ID = field.NewInt64(table, "id")
|
||||
a.RecordID = field.NewInt64(table, "record_id")
|
||||
a.ConnectorID = field.NewInt64(table, "connector_id")
|
||||
a.PublishConfig = field.NewField(table, "publish_config")
|
||||
a.PublishStatus = field.NewInt32(table, "publish_status")
|
||||
a.CreatedAt = field.NewInt64(table, "created_at")
|
||||
a.UpdatedAt = field.NewInt64(table, "updated_at")
|
||||
|
||||
a.fillFieldMap()
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *appConnectorReleaseRef) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := a.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (a *appConnectorReleaseRef) fillFieldMap() {
|
||||
a.fieldMap = make(map[string]field.Expr, 7)
|
||||
a.fieldMap["id"] = a.ID
|
||||
a.fieldMap["record_id"] = a.RecordID
|
||||
a.fieldMap["connector_id"] = a.ConnectorID
|
||||
a.fieldMap["publish_config"] = a.PublishConfig
|
||||
a.fieldMap["publish_status"] = a.PublishStatus
|
||||
a.fieldMap["created_at"] = a.CreatedAt
|
||||
a.fieldMap["updated_at"] = a.UpdatedAt
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRef) clone(db *gorm.DB) appConnectorReleaseRef {
|
||||
a.appConnectorReleaseRefDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return a
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRef) replaceDB(db *gorm.DB) appConnectorReleaseRef {
|
||||
a.appConnectorReleaseRefDo.ReplaceDB(db)
|
||||
return a
|
||||
}
|
||||
|
||||
type appConnectorReleaseRefDo struct{ gen.DO }
|
||||
|
||||
type IAppConnectorReleaseRefDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IAppConnectorReleaseRefDo
|
||||
WithContext(ctx context.Context) IAppConnectorReleaseRefDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IAppConnectorReleaseRefDo
|
||||
WriteDB() IAppConnectorReleaseRefDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IAppConnectorReleaseRefDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IAppConnectorReleaseRefDo
|
||||
Not(conds ...gen.Condition) IAppConnectorReleaseRefDo
|
||||
Or(conds ...gen.Condition) IAppConnectorReleaseRefDo
|
||||
Select(conds ...field.Expr) IAppConnectorReleaseRefDo
|
||||
Where(conds ...gen.Condition) IAppConnectorReleaseRefDo
|
||||
Order(conds ...field.Expr) IAppConnectorReleaseRefDo
|
||||
Distinct(cols ...field.Expr) IAppConnectorReleaseRefDo
|
||||
Omit(cols ...field.Expr) IAppConnectorReleaseRefDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IAppConnectorReleaseRefDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IAppConnectorReleaseRefDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IAppConnectorReleaseRefDo
|
||||
Group(cols ...field.Expr) IAppConnectorReleaseRefDo
|
||||
Having(conds ...gen.Condition) IAppConnectorReleaseRefDo
|
||||
Limit(limit int) IAppConnectorReleaseRefDo
|
||||
Offset(offset int) IAppConnectorReleaseRefDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IAppConnectorReleaseRefDo
|
||||
Unscoped() IAppConnectorReleaseRefDo
|
||||
Create(values ...*model.AppConnectorReleaseRef) error
|
||||
CreateInBatches(values []*model.AppConnectorReleaseRef, batchSize int) error
|
||||
Save(values ...*model.AppConnectorReleaseRef) error
|
||||
First() (*model.AppConnectorReleaseRef, error)
|
||||
Take() (*model.AppConnectorReleaseRef, error)
|
||||
Last() (*model.AppConnectorReleaseRef, error)
|
||||
Find() ([]*model.AppConnectorReleaseRef, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AppConnectorReleaseRef, err error)
|
||||
FindInBatches(result *[]*model.AppConnectorReleaseRef, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.AppConnectorReleaseRef) (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) IAppConnectorReleaseRefDo
|
||||
Assign(attrs ...field.AssignExpr) IAppConnectorReleaseRefDo
|
||||
Joins(fields ...field.RelationField) IAppConnectorReleaseRefDo
|
||||
Preload(fields ...field.RelationField) IAppConnectorReleaseRefDo
|
||||
FirstOrInit() (*model.AppConnectorReleaseRef, error)
|
||||
FirstOrCreate() (*model.AppConnectorReleaseRef, error)
|
||||
FindByPage(offset int, limit int) (result []*model.AppConnectorReleaseRef, 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) IAppConnectorReleaseRefDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Debug() IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Debug())
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) WithContext(ctx context.Context) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) ReadDB() IAppConnectorReleaseRefDo {
|
||||
return a.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) WriteDB() IAppConnectorReleaseRefDo {
|
||||
return a.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Session(config *gorm.Session) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Session(config))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Clauses(conds ...clause.Expression) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Returning(value interface{}, columns ...string) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Not(conds ...gen.Condition) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Or(conds ...gen.Condition) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Select(conds ...field.Expr) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Where(conds ...gen.Condition) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Order(conds ...field.Expr) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Distinct(cols ...field.Expr) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Omit(cols ...field.Expr) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Join(table schema.Tabler, on ...field.Expr) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) LeftJoin(table schema.Tabler, on ...field.Expr) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) RightJoin(table schema.Tabler, on ...field.Expr) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Group(cols ...field.Expr) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Having(conds ...gen.Condition) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Limit(limit int) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Offset(offset int) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Unscoped() IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Create(values ...*model.AppConnectorReleaseRef) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return a.DO.Create(values)
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) CreateInBatches(values []*model.AppConnectorReleaseRef, batchSize int) error {
|
||||
return a.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 (a appConnectorReleaseRefDo) Save(values ...*model.AppConnectorReleaseRef) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return a.DO.Save(values)
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) First() (*model.AppConnectorReleaseRef, error) {
|
||||
if result, err := a.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppConnectorReleaseRef), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Take() (*model.AppConnectorReleaseRef, error) {
|
||||
if result, err := a.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppConnectorReleaseRef), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Last() (*model.AppConnectorReleaseRef, error) {
|
||||
if result, err := a.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppConnectorReleaseRef), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Find() ([]*model.AppConnectorReleaseRef, error) {
|
||||
result, err := a.DO.Find()
|
||||
return result.([]*model.AppConnectorReleaseRef), err
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AppConnectorReleaseRef, err error) {
|
||||
buf := make([]*model.AppConnectorReleaseRef, 0, batchSize)
|
||||
err = a.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 (a appConnectorReleaseRefDo) FindInBatches(result *[]*model.AppConnectorReleaseRef, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return a.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Attrs(attrs ...field.AssignExpr) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Assign(attrs ...field.AssignExpr) IAppConnectorReleaseRefDo {
|
||||
return a.withDO(a.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Joins(fields ...field.RelationField) IAppConnectorReleaseRefDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Joins(_f))
|
||||
}
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Preload(fields ...field.RelationField) IAppConnectorReleaseRefDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Preload(_f))
|
||||
}
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) FirstOrInit() (*model.AppConnectorReleaseRef, error) {
|
||||
if result, err := a.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppConnectorReleaseRef), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) FirstOrCreate() (*model.AppConnectorReleaseRef, error) {
|
||||
if result, err := a.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppConnectorReleaseRef), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) FindByPage(offset int, limit int) (result []*model.AppConnectorReleaseRef, count int64, err error) {
|
||||
result, err = a.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 = a.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = a.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = a.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Scan(result interface{}) (err error) {
|
||||
return a.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (a appConnectorReleaseRefDo) Delete(models ...*model.AppConnectorReleaseRef) (result gen.ResultInfo, err error) {
|
||||
return a.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (a *appConnectorReleaseRefDo) withDO(do gen.Dao) *appConnectorReleaseRefDo {
|
||||
a.DO = *do.(*gen.DO)
|
||||
return a
|
||||
}
|
||||
413
backend/domain/app/internal/dal/query/app_draft.gen.go
Normal file
413
backend/domain/app/internal/dal/query/app_draft.gen.go
Normal file
@@ -0,0 +1,413 @@
|
||||
// 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"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/app/internal/dal/model"
|
||||
)
|
||||
|
||||
func newAppDraft(db *gorm.DB, opts ...gen.DOOption) appDraft {
|
||||
_appDraft := appDraft{}
|
||||
|
||||
_appDraft.appDraftDo.UseDB(db, opts...)
|
||||
_appDraft.appDraftDo.UseModel(&model.AppDraft{})
|
||||
|
||||
tableName := _appDraft.appDraftDo.TableName()
|
||||
_appDraft.ALL = field.NewAsterisk(tableName)
|
||||
_appDraft.ID = field.NewInt64(tableName, "id")
|
||||
_appDraft.SpaceID = field.NewInt64(tableName, "space_id")
|
||||
_appDraft.OwnerID = field.NewInt64(tableName, "owner_id")
|
||||
_appDraft.IconURI = field.NewString(tableName, "icon_uri")
|
||||
_appDraft.Name = field.NewString(tableName, "name")
|
||||
_appDraft.Description = field.NewString(tableName, "description")
|
||||
_appDraft.CreatedAt = field.NewInt64(tableName, "created_at")
|
||||
_appDraft.UpdatedAt = field.NewInt64(tableName, "updated_at")
|
||||
_appDraft.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_appDraft.fillFieldMap()
|
||||
|
||||
return _appDraft
|
||||
}
|
||||
|
||||
// appDraft Draft Application
|
||||
type appDraft struct {
|
||||
appDraftDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // APP ID
|
||||
SpaceID field.Int64 // Space ID
|
||||
OwnerID field.Int64 // Owner ID
|
||||
IconURI field.String // Icon URI
|
||||
Name field.String // Application Name
|
||||
Description field.String // Application Description
|
||||
CreatedAt field.Int64 // Create Time in Milliseconds
|
||||
UpdatedAt field.Int64 // Update Time in Milliseconds
|
||||
DeletedAt field.Field // Delete Time
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (a appDraft) Table(newTableName string) *appDraft {
|
||||
a.appDraftDo.UseTable(newTableName)
|
||||
return a.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (a appDraft) As(alias string) *appDraft {
|
||||
a.appDraftDo.DO = *(a.appDraftDo.As(alias).(*gen.DO))
|
||||
return a.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (a *appDraft) updateTableName(table string) *appDraft {
|
||||
a.ALL = field.NewAsterisk(table)
|
||||
a.ID = field.NewInt64(table, "id")
|
||||
a.SpaceID = field.NewInt64(table, "space_id")
|
||||
a.OwnerID = field.NewInt64(table, "owner_id")
|
||||
a.IconURI = field.NewString(table, "icon_uri")
|
||||
a.Name = field.NewString(table, "name")
|
||||
a.Description = field.NewString(table, "description")
|
||||
a.CreatedAt = field.NewInt64(table, "created_at")
|
||||
a.UpdatedAt = field.NewInt64(table, "updated_at")
|
||||
a.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
a.fillFieldMap()
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *appDraft) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := a.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (a *appDraft) fillFieldMap() {
|
||||
a.fieldMap = make(map[string]field.Expr, 9)
|
||||
a.fieldMap["id"] = a.ID
|
||||
a.fieldMap["space_id"] = a.SpaceID
|
||||
a.fieldMap["owner_id"] = a.OwnerID
|
||||
a.fieldMap["icon_uri"] = a.IconURI
|
||||
a.fieldMap["name"] = a.Name
|
||||
a.fieldMap["description"] = a.Description
|
||||
a.fieldMap["created_at"] = a.CreatedAt
|
||||
a.fieldMap["updated_at"] = a.UpdatedAt
|
||||
a.fieldMap["deleted_at"] = a.DeletedAt
|
||||
}
|
||||
|
||||
func (a appDraft) clone(db *gorm.DB) appDraft {
|
||||
a.appDraftDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return a
|
||||
}
|
||||
|
||||
func (a appDraft) replaceDB(db *gorm.DB) appDraft {
|
||||
a.appDraftDo.ReplaceDB(db)
|
||||
return a
|
||||
}
|
||||
|
||||
type appDraftDo struct{ gen.DO }
|
||||
|
||||
type IAppDraftDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IAppDraftDo
|
||||
WithContext(ctx context.Context) IAppDraftDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IAppDraftDo
|
||||
WriteDB() IAppDraftDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IAppDraftDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IAppDraftDo
|
||||
Not(conds ...gen.Condition) IAppDraftDo
|
||||
Or(conds ...gen.Condition) IAppDraftDo
|
||||
Select(conds ...field.Expr) IAppDraftDo
|
||||
Where(conds ...gen.Condition) IAppDraftDo
|
||||
Order(conds ...field.Expr) IAppDraftDo
|
||||
Distinct(cols ...field.Expr) IAppDraftDo
|
||||
Omit(cols ...field.Expr) IAppDraftDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IAppDraftDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IAppDraftDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IAppDraftDo
|
||||
Group(cols ...field.Expr) IAppDraftDo
|
||||
Having(conds ...gen.Condition) IAppDraftDo
|
||||
Limit(limit int) IAppDraftDo
|
||||
Offset(offset int) IAppDraftDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IAppDraftDo
|
||||
Unscoped() IAppDraftDo
|
||||
Create(values ...*model.AppDraft) error
|
||||
CreateInBatches(values []*model.AppDraft, batchSize int) error
|
||||
Save(values ...*model.AppDraft) error
|
||||
First() (*model.AppDraft, error)
|
||||
Take() (*model.AppDraft, error)
|
||||
Last() (*model.AppDraft, error)
|
||||
Find() ([]*model.AppDraft, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AppDraft, err error)
|
||||
FindInBatches(result *[]*model.AppDraft, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.AppDraft) (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) IAppDraftDo
|
||||
Assign(attrs ...field.AssignExpr) IAppDraftDo
|
||||
Joins(fields ...field.RelationField) IAppDraftDo
|
||||
Preload(fields ...field.RelationField) IAppDraftDo
|
||||
FirstOrInit() (*model.AppDraft, error)
|
||||
FirstOrCreate() (*model.AppDraft, error)
|
||||
FindByPage(offset int, limit int) (result []*model.AppDraft, 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) IAppDraftDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (a appDraftDo) Debug() IAppDraftDo {
|
||||
return a.withDO(a.DO.Debug())
|
||||
}
|
||||
|
||||
func (a appDraftDo) WithContext(ctx context.Context) IAppDraftDo {
|
||||
return a.withDO(a.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (a appDraftDo) ReadDB() IAppDraftDo {
|
||||
return a.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (a appDraftDo) WriteDB() IAppDraftDo {
|
||||
return a.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (a appDraftDo) Session(config *gorm.Session) IAppDraftDo {
|
||||
return a.withDO(a.DO.Session(config))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Clauses(conds ...clause.Expression) IAppDraftDo {
|
||||
return a.withDO(a.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Returning(value interface{}, columns ...string) IAppDraftDo {
|
||||
return a.withDO(a.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Not(conds ...gen.Condition) IAppDraftDo {
|
||||
return a.withDO(a.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Or(conds ...gen.Condition) IAppDraftDo {
|
||||
return a.withDO(a.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Select(conds ...field.Expr) IAppDraftDo {
|
||||
return a.withDO(a.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Where(conds ...gen.Condition) IAppDraftDo {
|
||||
return a.withDO(a.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Order(conds ...field.Expr) IAppDraftDo {
|
||||
return a.withDO(a.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Distinct(cols ...field.Expr) IAppDraftDo {
|
||||
return a.withDO(a.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Omit(cols ...field.Expr) IAppDraftDo {
|
||||
return a.withDO(a.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Join(table schema.Tabler, on ...field.Expr) IAppDraftDo {
|
||||
return a.withDO(a.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) LeftJoin(table schema.Tabler, on ...field.Expr) IAppDraftDo {
|
||||
return a.withDO(a.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) RightJoin(table schema.Tabler, on ...field.Expr) IAppDraftDo {
|
||||
return a.withDO(a.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Group(cols ...field.Expr) IAppDraftDo {
|
||||
return a.withDO(a.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Having(conds ...gen.Condition) IAppDraftDo {
|
||||
return a.withDO(a.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Limit(limit int) IAppDraftDo {
|
||||
return a.withDO(a.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Offset(offset int) IAppDraftDo {
|
||||
return a.withDO(a.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IAppDraftDo {
|
||||
return a.withDO(a.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Unscoped() IAppDraftDo {
|
||||
return a.withDO(a.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (a appDraftDo) Create(values ...*model.AppDraft) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return a.DO.Create(values)
|
||||
}
|
||||
|
||||
func (a appDraftDo) CreateInBatches(values []*model.AppDraft, batchSize int) error {
|
||||
return a.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 (a appDraftDo) Save(values ...*model.AppDraft) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return a.DO.Save(values)
|
||||
}
|
||||
|
||||
func (a appDraftDo) First() (*model.AppDraft, error) {
|
||||
if result, err := a.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppDraft), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appDraftDo) Take() (*model.AppDraft, error) {
|
||||
if result, err := a.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppDraft), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appDraftDo) Last() (*model.AppDraft, error) {
|
||||
if result, err := a.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppDraft), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appDraftDo) Find() ([]*model.AppDraft, error) {
|
||||
result, err := a.DO.Find()
|
||||
return result.([]*model.AppDraft), err
|
||||
}
|
||||
|
||||
func (a appDraftDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AppDraft, err error) {
|
||||
buf := make([]*model.AppDraft, 0, batchSize)
|
||||
err = a.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 (a appDraftDo) FindInBatches(result *[]*model.AppDraft, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return a.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (a appDraftDo) Attrs(attrs ...field.AssignExpr) IAppDraftDo {
|
||||
return a.withDO(a.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Assign(attrs ...field.AssignExpr) IAppDraftDo {
|
||||
return a.withDO(a.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (a appDraftDo) Joins(fields ...field.RelationField) IAppDraftDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Joins(_f))
|
||||
}
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a appDraftDo) Preload(fields ...field.RelationField) IAppDraftDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Preload(_f))
|
||||
}
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a appDraftDo) FirstOrInit() (*model.AppDraft, error) {
|
||||
if result, err := a.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppDraft), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appDraftDo) FirstOrCreate() (*model.AppDraft, error) {
|
||||
if result, err := a.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppDraft), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appDraftDo) FindByPage(offset int, limit int) (result []*model.AppDraft, count int64, err error) {
|
||||
result, err = a.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 = a.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (a appDraftDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = a.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = a.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (a appDraftDo) Scan(result interface{}) (err error) {
|
||||
return a.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (a appDraftDo) Delete(models ...*model.AppDraft) (result gen.ResultInfo, err error) {
|
||||
return a.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (a *appDraftDo) withDO(do gen.Dao) *appDraftDo {
|
||||
a.DO = *do.(*gen.DO)
|
||||
return a
|
||||
}
|
||||
437
backend/domain/app/internal/dal/query/app_release_record.gen.go
Normal file
437
backend/domain/app/internal/dal/query/app_release_record.gen.go
Normal file
@@ -0,0 +1,437 @@
|
||||
// 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"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/app/internal/dal/model"
|
||||
)
|
||||
|
||||
func newAppReleaseRecord(db *gorm.DB, opts ...gen.DOOption) appReleaseRecord {
|
||||
_appReleaseRecord := appReleaseRecord{}
|
||||
|
||||
_appReleaseRecord.appReleaseRecordDo.UseDB(db, opts...)
|
||||
_appReleaseRecord.appReleaseRecordDo.UseModel(&model.AppReleaseRecord{})
|
||||
|
||||
tableName := _appReleaseRecord.appReleaseRecordDo.TableName()
|
||||
_appReleaseRecord.ALL = field.NewAsterisk(tableName)
|
||||
_appReleaseRecord.ID = field.NewInt64(tableName, "id")
|
||||
_appReleaseRecord.AppID = field.NewInt64(tableName, "app_id")
|
||||
_appReleaseRecord.SpaceID = field.NewInt64(tableName, "space_id")
|
||||
_appReleaseRecord.OwnerID = field.NewInt64(tableName, "owner_id")
|
||||
_appReleaseRecord.IconURI = field.NewString(tableName, "icon_uri")
|
||||
_appReleaseRecord.Name = field.NewString(tableName, "name")
|
||||
_appReleaseRecord.Description = field.NewString(tableName, "description")
|
||||
_appReleaseRecord.ConnectorIds = field.NewField(tableName, "connector_ids")
|
||||
_appReleaseRecord.ExtraInfo = field.NewField(tableName, "extra_info")
|
||||
_appReleaseRecord.Version = field.NewString(tableName, "version")
|
||||
_appReleaseRecord.VersionDesc = field.NewString(tableName, "version_desc")
|
||||
_appReleaseRecord.PublishStatus = field.NewInt32(tableName, "publish_status")
|
||||
_appReleaseRecord.PublishAt = field.NewInt64(tableName, "publish_at")
|
||||
_appReleaseRecord.CreatedAt = field.NewInt64(tableName, "created_at")
|
||||
_appReleaseRecord.UpdatedAt = field.NewInt64(tableName, "updated_at")
|
||||
|
||||
_appReleaseRecord.fillFieldMap()
|
||||
|
||||
return _appReleaseRecord
|
||||
}
|
||||
|
||||
// appReleaseRecord Application Release Record
|
||||
type appReleaseRecord struct {
|
||||
appReleaseRecordDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // Publish Record ID
|
||||
AppID field.Int64 // Application ID
|
||||
SpaceID field.Int64 // Space ID
|
||||
OwnerID field.Int64 // Owner ID
|
||||
IconURI field.String // Icon URI
|
||||
Name field.String // Application Name
|
||||
Description field.String // Application Description
|
||||
ConnectorIds field.Field // Publish Connector IDs
|
||||
ExtraInfo field.Field // Publish Extra Info
|
||||
Version field.String // Release Version
|
||||
VersionDesc field.String // Version Description
|
||||
PublishStatus field.Int32 // Publish Status
|
||||
PublishAt field.Int64 // Publish Time in Milliseconds
|
||||
CreatedAt field.Int64 // Create Time in Milliseconds
|
||||
UpdatedAt field.Int64 // Update Time in Milliseconds
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (a appReleaseRecord) Table(newTableName string) *appReleaseRecord {
|
||||
a.appReleaseRecordDo.UseTable(newTableName)
|
||||
return a.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (a appReleaseRecord) As(alias string) *appReleaseRecord {
|
||||
a.appReleaseRecordDo.DO = *(a.appReleaseRecordDo.As(alias).(*gen.DO))
|
||||
return a.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (a *appReleaseRecord) updateTableName(table string) *appReleaseRecord {
|
||||
a.ALL = field.NewAsterisk(table)
|
||||
a.ID = field.NewInt64(table, "id")
|
||||
a.AppID = field.NewInt64(table, "app_id")
|
||||
a.SpaceID = field.NewInt64(table, "space_id")
|
||||
a.OwnerID = field.NewInt64(table, "owner_id")
|
||||
a.IconURI = field.NewString(table, "icon_uri")
|
||||
a.Name = field.NewString(table, "name")
|
||||
a.Description = field.NewString(table, "description")
|
||||
a.ConnectorIds = field.NewField(table, "connector_ids")
|
||||
a.ExtraInfo = field.NewField(table, "extra_info")
|
||||
a.Version = field.NewString(table, "version")
|
||||
a.VersionDesc = field.NewString(table, "version_desc")
|
||||
a.PublishStatus = field.NewInt32(table, "publish_status")
|
||||
a.PublishAt = field.NewInt64(table, "publish_at")
|
||||
a.CreatedAt = field.NewInt64(table, "created_at")
|
||||
a.UpdatedAt = field.NewInt64(table, "updated_at")
|
||||
|
||||
a.fillFieldMap()
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *appReleaseRecord) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := a.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (a *appReleaseRecord) fillFieldMap() {
|
||||
a.fieldMap = make(map[string]field.Expr, 15)
|
||||
a.fieldMap["id"] = a.ID
|
||||
a.fieldMap["app_id"] = a.AppID
|
||||
a.fieldMap["space_id"] = a.SpaceID
|
||||
a.fieldMap["owner_id"] = a.OwnerID
|
||||
a.fieldMap["icon_uri"] = a.IconURI
|
||||
a.fieldMap["name"] = a.Name
|
||||
a.fieldMap["description"] = a.Description
|
||||
a.fieldMap["connector_ids"] = a.ConnectorIds
|
||||
a.fieldMap["extra_info"] = a.ExtraInfo
|
||||
a.fieldMap["version"] = a.Version
|
||||
a.fieldMap["version_desc"] = a.VersionDesc
|
||||
a.fieldMap["publish_status"] = a.PublishStatus
|
||||
a.fieldMap["publish_at"] = a.PublishAt
|
||||
a.fieldMap["created_at"] = a.CreatedAt
|
||||
a.fieldMap["updated_at"] = a.UpdatedAt
|
||||
}
|
||||
|
||||
func (a appReleaseRecord) clone(db *gorm.DB) appReleaseRecord {
|
||||
a.appReleaseRecordDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return a
|
||||
}
|
||||
|
||||
func (a appReleaseRecord) replaceDB(db *gorm.DB) appReleaseRecord {
|
||||
a.appReleaseRecordDo.ReplaceDB(db)
|
||||
return a
|
||||
}
|
||||
|
||||
type appReleaseRecordDo struct{ gen.DO }
|
||||
|
||||
type IAppReleaseRecordDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IAppReleaseRecordDo
|
||||
WithContext(ctx context.Context) IAppReleaseRecordDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IAppReleaseRecordDo
|
||||
WriteDB() IAppReleaseRecordDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IAppReleaseRecordDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IAppReleaseRecordDo
|
||||
Not(conds ...gen.Condition) IAppReleaseRecordDo
|
||||
Or(conds ...gen.Condition) IAppReleaseRecordDo
|
||||
Select(conds ...field.Expr) IAppReleaseRecordDo
|
||||
Where(conds ...gen.Condition) IAppReleaseRecordDo
|
||||
Order(conds ...field.Expr) IAppReleaseRecordDo
|
||||
Distinct(cols ...field.Expr) IAppReleaseRecordDo
|
||||
Omit(cols ...field.Expr) IAppReleaseRecordDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IAppReleaseRecordDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IAppReleaseRecordDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IAppReleaseRecordDo
|
||||
Group(cols ...field.Expr) IAppReleaseRecordDo
|
||||
Having(conds ...gen.Condition) IAppReleaseRecordDo
|
||||
Limit(limit int) IAppReleaseRecordDo
|
||||
Offset(offset int) IAppReleaseRecordDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IAppReleaseRecordDo
|
||||
Unscoped() IAppReleaseRecordDo
|
||||
Create(values ...*model.AppReleaseRecord) error
|
||||
CreateInBatches(values []*model.AppReleaseRecord, batchSize int) error
|
||||
Save(values ...*model.AppReleaseRecord) error
|
||||
First() (*model.AppReleaseRecord, error)
|
||||
Take() (*model.AppReleaseRecord, error)
|
||||
Last() (*model.AppReleaseRecord, error)
|
||||
Find() ([]*model.AppReleaseRecord, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AppReleaseRecord, err error)
|
||||
FindInBatches(result *[]*model.AppReleaseRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.AppReleaseRecord) (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) IAppReleaseRecordDo
|
||||
Assign(attrs ...field.AssignExpr) IAppReleaseRecordDo
|
||||
Joins(fields ...field.RelationField) IAppReleaseRecordDo
|
||||
Preload(fields ...field.RelationField) IAppReleaseRecordDo
|
||||
FirstOrInit() (*model.AppReleaseRecord, error)
|
||||
FirstOrCreate() (*model.AppReleaseRecord, error)
|
||||
FindByPage(offset int, limit int) (result []*model.AppReleaseRecord, 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) IAppReleaseRecordDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Debug() IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Debug())
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) WithContext(ctx context.Context) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) ReadDB() IAppReleaseRecordDo {
|
||||
return a.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) WriteDB() IAppReleaseRecordDo {
|
||||
return a.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Session(config *gorm.Session) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Session(config))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Clauses(conds ...clause.Expression) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Returning(value interface{}, columns ...string) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Not(conds ...gen.Condition) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Or(conds ...gen.Condition) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Select(conds ...field.Expr) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Where(conds ...gen.Condition) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Order(conds ...field.Expr) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Distinct(cols ...field.Expr) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Omit(cols ...field.Expr) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Join(table schema.Tabler, on ...field.Expr) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) LeftJoin(table schema.Tabler, on ...field.Expr) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) RightJoin(table schema.Tabler, on ...field.Expr) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Group(cols ...field.Expr) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Having(conds ...gen.Condition) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Limit(limit int) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Offset(offset int) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Unscoped() IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Create(values ...*model.AppReleaseRecord) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return a.DO.Create(values)
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) CreateInBatches(values []*model.AppReleaseRecord, batchSize int) error {
|
||||
return a.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 (a appReleaseRecordDo) Save(values ...*model.AppReleaseRecord) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return a.DO.Save(values)
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) First() (*model.AppReleaseRecord, error) {
|
||||
if result, err := a.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppReleaseRecord), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Take() (*model.AppReleaseRecord, error) {
|
||||
if result, err := a.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppReleaseRecord), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Last() (*model.AppReleaseRecord, error) {
|
||||
if result, err := a.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppReleaseRecord), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Find() ([]*model.AppReleaseRecord, error) {
|
||||
result, err := a.DO.Find()
|
||||
return result.([]*model.AppReleaseRecord), err
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AppReleaseRecord, err error) {
|
||||
buf := make([]*model.AppReleaseRecord, 0, batchSize)
|
||||
err = a.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 (a appReleaseRecordDo) FindInBatches(result *[]*model.AppReleaseRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return a.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Attrs(attrs ...field.AssignExpr) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Assign(attrs ...field.AssignExpr) IAppReleaseRecordDo {
|
||||
return a.withDO(a.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Joins(fields ...field.RelationField) IAppReleaseRecordDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Joins(_f))
|
||||
}
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Preload(fields ...field.RelationField) IAppReleaseRecordDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Preload(_f))
|
||||
}
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) FirstOrInit() (*model.AppReleaseRecord, error) {
|
||||
if result, err := a.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppReleaseRecord), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) FirstOrCreate() (*model.AppReleaseRecord, error) {
|
||||
if result, err := a.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.AppReleaseRecord), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) FindByPage(offset int, limit int) (result []*model.AppReleaseRecord, count int64, err error) {
|
||||
result, err = a.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 = a.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = a.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = a.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Scan(result interface{}) (err error) {
|
||||
return a.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (a appReleaseRecordDo) Delete(models ...*model.AppReleaseRecord) (result gen.ResultInfo, err error) {
|
||||
return a.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (a *appReleaseRecordDo) withDO(do gen.Dao) *appReleaseRecordDo {
|
||||
a.DO = *do.(*gen.DO)
|
||||
return a
|
||||
}
|
||||
119
backend/domain/app/internal/dal/query/gen.go
Normal file
119
backend/domain/app/internal/dal/query/gen.go
Normal file
@@ -0,0 +1,119 @@
|
||||
// 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)
|
||||
AppConnectorReleaseRef *appConnectorReleaseRef
|
||||
AppDraft *appDraft
|
||||
AppReleaseRecord *appReleaseRecord
|
||||
)
|
||||
|
||||
func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
*Q = *Use(db, opts...)
|
||||
AppConnectorReleaseRef = &Q.AppConnectorReleaseRef
|
||||
AppDraft = &Q.AppDraft
|
||||
AppReleaseRecord = &Q.AppReleaseRecord
|
||||
}
|
||||
|
||||
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AppConnectorReleaseRef: newAppConnectorReleaseRef(db, opts...),
|
||||
AppDraft: newAppDraft(db, opts...),
|
||||
AppReleaseRecord: newAppReleaseRecord(db, opts...),
|
||||
}
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
db *gorm.DB
|
||||
|
||||
AppConnectorReleaseRef appConnectorReleaseRef
|
||||
AppDraft appDraft
|
||||
AppReleaseRecord appReleaseRecord
|
||||
}
|
||||
|
||||
func (q *Query) Available() bool { return q.db != nil }
|
||||
|
||||
func (q *Query) clone(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AppConnectorReleaseRef: q.AppConnectorReleaseRef.clone(db),
|
||||
AppDraft: q.AppDraft.clone(db),
|
||||
AppReleaseRecord: q.AppReleaseRecord.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,
|
||||
AppConnectorReleaseRef: q.AppConnectorReleaseRef.replaceDB(db),
|
||||
AppDraft: q.AppDraft.replaceDB(db),
|
||||
AppReleaseRecord: q.AppReleaseRecord.replaceDB(db),
|
||||
}
|
||||
}
|
||||
|
||||
type queryCtx struct {
|
||||
AppConnectorReleaseRef IAppConnectorReleaseRefDo
|
||||
AppDraft IAppDraftDo
|
||||
AppReleaseRecord IAppReleaseRecordDo
|
||||
}
|
||||
|
||||
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
return &queryCtx{
|
||||
AppConnectorReleaseRef: q.AppConnectorReleaseRef.WithContext(ctx),
|
||||
AppDraft: q.AppDraft.WithContext(ctx),
|
||||
AppReleaseRecord: q.AppReleaseRecord.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
|
||||
}
|
||||
Reference in New Issue
Block a user