|
@@ -0,0 +1,452 @@
|
|
|
+// 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"
|
|
|
+
|
|
|
+ "pji_desktop_http/biz/model"
|
|
|
+)
|
|
|
+
|
|
|
+func newSimulationTestRecord(db *gorm.DB, opts ...gen.DOOption) simulationTestRecord {
|
|
|
+ _simulationTestRecord := simulationTestRecord{}
|
|
|
+
|
|
|
+ _simulationTestRecord.simulationTestRecordDo.UseDB(db, opts...)
|
|
|
+ _simulationTestRecord.simulationTestRecordDo.UseModel(&model.SimulationTestRecord{})
|
|
|
+
|
|
|
+ tableName := _simulationTestRecord.simulationTestRecordDo.TableName()
|
|
|
+ _simulationTestRecord.ALL = field.NewAsterisk(tableName)
|
|
|
+ _simulationTestRecord.ID = field.NewString(tableName, "id")
|
|
|
+ _simulationTestRecord.DeviceID = field.NewString(tableName, "device_id")
|
|
|
+ _simulationTestRecord.DeviceName = field.NewString(tableName, "device_name")
|
|
|
+ _simulationTestRecord.DeviceType = field.NewString(tableName, "device_type")
|
|
|
+ _simulationTestRecord.AlgoImageName = field.NewString(tableName, "algo_image_name")
|
|
|
+ _simulationTestRecord.AlgoVersion = field.NewString(tableName, "algo_version")
|
|
|
+ _simulationTestRecord.PgmPath = field.NewString(tableName, "pgm_path")
|
|
|
+ _simulationTestRecord.WorldPath = field.NewString(tableName, "world_path")
|
|
|
+ _simulationTestRecord.TestBagPath = field.NewString(tableName, "test_bag_path")
|
|
|
+ _simulationTestRecord.TestDuration = field.NewInt32(tableName, "test_duration")
|
|
|
+ _simulationTestRecord.TestDistance = field.NewInt32(tableName, "test_distance")
|
|
|
+ _simulationTestRecord.AlgoEvaluationLevel = field.NewString(tableName, "algo_evaluation_level")
|
|
|
+ _simulationTestRecord.AlgoEvaluationReport = field.NewString(tableName, "algo_evaluation_report")
|
|
|
+ _simulationTestRecord.CreatedAt = field.NewTime(tableName, "created_at")
|
|
|
+ _simulationTestRecord.UpdatedAt = field.NewTime(tableName, "updated_at")
|
|
|
+ _simulationTestRecord.DeletedAt = field.NewField(tableName, "deleted_at")
|
|
|
+
|
|
|
+ _simulationTestRecord.fillFieldMap()
|
|
|
+
|
|
|
+ return _simulationTestRecord
|
|
|
+}
|
|
|
+
|
|
|
+type simulationTestRecord struct {
|
|
|
+ simulationTestRecordDo simulationTestRecordDo
|
|
|
+
|
|
|
+ ALL field.Asterisk
|
|
|
+ ID field.String
|
|
|
+ DeviceID field.String
|
|
|
+ DeviceName field.String
|
|
|
+ DeviceType field.String
|
|
|
+ AlgoImageName field.String
|
|
|
+ AlgoVersion field.String
|
|
|
+ PgmPath field.String
|
|
|
+ WorldPath field.String
|
|
|
+ TestBagPath field.String
|
|
|
+ TestDuration field.Int32
|
|
|
+ TestDistance field.Int32
|
|
|
+ AlgoEvaluationLevel field.String
|
|
|
+ AlgoEvaluationReport field.String
|
|
|
+ CreatedAt field.Time
|
|
|
+ UpdatedAt field.Time
|
|
|
+ DeletedAt field.Field
|
|
|
+
|
|
|
+ fieldMap map[string]field.Expr
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecord) Table(newTableName string) *simulationTestRecord {
|
|
|
+ s.simulationTestRecordDo.UseTable(newTableName)
|
|
|
+ return s.updateTableName(newTableName)
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecord) As(alias string) *simulationTestRecord {
|
|
|
+ s.simulationTestRecordDo.DO = *(s.simulationTestRecordDo.As(alias).(*gen.DO))
|
|
|
+ return s.updateTableName(alias)
|
|
|
+}
|
|
|
+
|
|
|
+func (s *simulationTestRecord) updateTableName(table string) *simulationTestRecord {
|
|
|
+ s.ALL = field.NewAsterisk(table)
|
|
|
+ s.ID = field.NewString(table, "id")
|
|
|
+ s.DeviceID = field.NewString(table, "device_id")
|
|
|
+ s.DeviceName = field.NewString(table, "device_name")
|
|
|
+ s.DeviceType = field.NewString(table, "device_type")
|
|
|
+ s.AlgoImageName = field.NewString(table, "algo_image_name")
|
|
|
+ s.AlgoVersion = field.NewString(table, "algo_version")
|
|
|
+ s.PgmPath = field.NewString(table, "pgm_path")
|
|
|
+ s.WorldPath = field.NewString(table, "world_path")
|
|
|
+ s.TestBagPath = field.NewString(table, "test_bag_path")
|
|
|
+ s.TestDuration = field.NewInt32(table, "test_duration")
|
|
|
+ s.TestDistance = field.NewInt32(table, "test_distance")
|
|
|
+ s.AlgoEvaluationLevel = field.NewString(table, "algo_evaluation_level")
|
|
|
+ s.AlgoEvaluationReport = field.NewString(table, "algo_evaluation_report")
|
|
|
+ s.CreatedAt = field.NewTime(table, "created_at")
|
|
|
+ s.UpdatedAt = field.NewTime(table, "updated_at")
|
|
|
+ s.DeletedAt = field.NewField(table, "deleted_at")
|
|
|
+
|
|
|
+ s.fillFieldMap()
|
|
|
+
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+func (s *simulationTestRecord) WithContext(ctx context.Context) ISimulationTestRecordDo {
|
|
|
+ return s.simulationTestRecordDo.WithContext(ctx)
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecord) TableName() string { return s.simulationTestRecordDo.TableName() }
|
|
|
+
|
|
|
+func (s simulationTestRecord) Alias() string { return s.simulationTestRecordDo.Alias() }
|
|
|
+
|
|
|
+func (s simulationTestRecord) Columns(cols ...field.Expr) gen.Columns {
|
|
|
+ return s.simulationTestRecordDo.Columns(cols...)
|
|
|
+}
|
|
|
+
|
|
|
+func (s *simulationTestRecord) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|
|
+ _f, ok := s.fieldMap[fieldName]
|
|
|
+ if !ok || _f == nil {
|
|
|
+ return nil, false
|
|
|
+ }
|
|
|
+ _oe, ok := _f.(field.OrderExpr)
|
|
|
+ return _oe, ok
|
|
|
+}
|
|
|
+
|
|
|
+func (s *simulationTestRecord) fillFieldMap() {
|
|
|
+ s.fieldMap = make(map[string]field.Expr, 16)
|
|
|
+ s.fieldMap["id"] = s.ID
|
|
|
+ s.fieldMap["device_id"] = s.DeviceID
|
|
|
+ s.fieldMap["device_name"] = s.DeviceName
|
|
|
+ s.fieldMap["device_type"] = s.DeviceType
|
|
|
+ s.fieldMap["algo_image_name"] = s.AlgoImageName
|
|
|
+ s.fieldMap["algo_version"] = s.AlgoVersion
|
|
|
+ s.fieldMap["pgm_path"] = s.PgmPath
|
|
|
+ s.fieldMap["world_path"] = s.WorldPath
|
|
|
+ s.fieldMap["test_bag_path"] = s.TestBagPath
|
|
|
+ s.fieldMap["test_duration"] = s.TestDuration
|
|
|
+ s.fieldMap["test_distance"] = s.TestDistance
|
|
|
+ s.fieldMap["algo_evaluation_level"] = s.AlgoEvaluationLevel
|
|
|
+ s.fieldMap["algo_evaluation_report"] = s.AlgoEvaluationReport
|
|
|
+ s.fieldMap["created_at"] = s.CreatedAt
|
|
|
+ s.fieldMap["updated_at"] = s.UpdatedAt
|
|
|
+ s.fieldMap["deleted_at"] = s.DeletedAt
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecord) clone(db *gorm.DB) simulationTestRecord {
|
|
|
+ s.simulationTestRecordDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecord) replaceDB(db *gorm.DB) simulationTestRecord {
|
|
|
+ s.simulationTestRecordDo.ReplaceDB(db)
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+type simulationTestRecordDo struct{ gen.DO }
|
|
|
+
|
|
|
+type ISimulationTestRecordDo interface {
|
|
|
+ gen.SubQuery
|
|
|
+ Debug() ISimulationTestRecordDo
|
|
|
+ WithContext(ctx context.Context) ISimulationTestRecordDo
|
|
|
+ WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
|
|
+ ReplaceDB(db *gorm.DB)
|
|
|
+ ReadDB() ISimulationTestRecordDo
|
|
|
+ WriteDB() ISimulationTestRecordDo
|
|
|
+ As(alias string) gen.Dao
|
|
|
+ Session(config *gorm.Session) ISimulationTestRecordDo
|
|
|
+ Columns(cols ...field.Expr) gen.Columns
|
|
|
+ Clauses(conds ...clause.Expression) ISimulationTestRecordDo
|
|
|
+ Not(conds ...gen.Condition) ISimulationTestRecordDo
|
|
|
+ Or(conds ...gen.Condition) ISimulationTestRecordDo
|
|
|
+ Select(conds ...field.Expr) ISimulationTestRecordDo
|
|
|
+ Where(conds ...gen.Condition) ISimulationTestRecordDo
|
|
|
+ Order(conds ...field.Expr) ISimulationTestRecordDo
|
|
|
+ Distinct(cols ...field.Expr) ISimulationTestRecordDo
|
|
|
+ Omit(cols ...field.Expr) ISimulationTestRecordDo
|
|
|
+ Join(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo
|
|
|
+ LeftJoin(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo
|
|
|
+ RightJoin(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo
|
|
|
+ Group(cols ...field.Expr) ISimulationTestRecordDo
|
|
|
+ Having(conds ...gen.Condition) ISimulationTestRecordDo
|
|
|
+ Limit(limit int) ISimulationTestRecordDo
|
|
|
+ Offset(offset int) ISimulationTestRecordDo
|
|
|
+ Count() (count int64, err error)
|
|
|
+ Scopes(funcs ...func(gen.Dao) gen.Dao) ISimulationTestRecordDo
|
|
|
+ Unscoped() ISimulationTestRecordDo
|
|
|
+ Create(values ...*model.SimulationTestRecord) error
|
|
|
+ CreateInBatches(values []*model.SimulationTestRecord, batchSize int) error
|
|
|
+ Save(values ...*model.SimulationTestRecord) error
|
|
|
+ First() (*model.SimulationTestRecord, error)
|
|
|
+ Take() (*model.SimulationTestRecord, error)
|
|
|
+ Last() (*model.SimulationTestRecord, error)
|
|
|
+ Find() ([]*model.SimulationTestRecord, error)
|
|
|
+ FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SimulationTestRecord, err error)
|
|
|
+ FindInBatches(result *[]*model.SimulationTestRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
|
|
+ Pluck(column field.Expr, dest interface{}) error
|
|
|
+ Delete(...*model.SimulationTestRecord) (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) ISimulationTestRecordDo
|
|
|
+ Assign(attrs ...field.AssignExpr) ISimulationTestRecordDo
|
|
|
+ Joins(fields ...field.RelationField) ISimulationTestRecordDo
|
|
|
+ Preload(fields ...field.RelationField) ISimulationTestRecordDo
|
|
|
+ FirstOrInit() (*model.SimulationTestRecord, error)
|
|
|
+ FirstOrCreate() (*model.SimulationTestRecord, error)
|
|
|
+ FindByPage(offset int, limit int) (result []*model.SimulationTestRecord, 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) ISimulationTestRecordDo
|
|
|
+ UnderlyingDB() *gorm.DB
|
|
|
+ schema.Tabler
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Debug() ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Debug())
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) WithContext(ctx context.Context) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.WithContext(ctx))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) ReadDB() ISimulationTestRecordDo {
|
|
|
+ return s.Clauses(dbresolver.Read)
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) WriteDB() ISimulationTestRecordDo {
|
|
|
+ return s.Clauses(dbresolver.Write)
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Session(config *gorm.Session) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Session(config))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Clauses(conds ...clause.Expression) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Clauses(conds...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Returning(value interface{}, columns ...string) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Returning(value, columns...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Not(conds ...gen.Condition) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Not(conds...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Or(conds ...gen.Condition) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Or(conds...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Select(conds ...field.Expr) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Select(conds...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Where(conds ...gen.Condition) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Where(conds...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Order(conds ...field.Expr) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Order(conds...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Distinct(cols ...field.Expr) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Distinct(cols...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Omit(cols ...field.Expr) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Omit(cols...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Join(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Join(table, on...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) LeftJoin(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.LeftJoin(table, on...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) RightJoin(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.RightJoin(table, on...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Group(cols ...field.Expr) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Group(cols...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Having(conds ...gen.Condition) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Having(conds...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Limit(limit int) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Limit(limit))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Offset(offset int) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Offset(offset))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Scopes(funcs...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Unscoped() ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Unscoped())
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Create(values ...*model.SimulationTestRecord) error {
|
|
|
+ if len(values) == 0 {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return s.DO.Create(values)
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) CreateInBatches(values []*model.SimulationTestRecord, batchSize int) error {
|
|
|
+ return s.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 (s simulationTestRecordDo) Save(values ...*model.SimulationTestRecord) error {
|
|
|
+ if len(values) == 0 {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return s.DO.Save(values)
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) First() (*model.SimulationTestRecord, error) {
|
|
|
+ if result, err := s.DO.First(); err != nil {
|
|
|
+ return nil, err
|
|
|
+ } else {
|
|
|
+ return result.(*model.SimulationTestRecord), nil
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Take() (*model.SimulationTestRecord, error) {
|
|
|
+ if result, err := s.DO.Take(); err != nil {
|
|
|
+ return nil, err
|
|
|
+ } else {
|
|
|
+ return result.(*model.SimulationTestRecord), nil
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Last() (*model.SimulationTestRecord, error) {
|
|
|
+ if result, err := s.DO.Last(); err != nil {
|
|
|
+ return nil, err
|
|
|
+ } else {
|
|
|
+ return result.(*model.SimulationTestRecord), nil
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Find() ([]*model.SimulationTestRecord, error) {
|
|
|
+ result, err := s.DO.Find()
|
|
|
+ return result.([]*model.SimulationTestRecord), err
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SimulationTestRecord, err error) {
|
|
|
+ buf := make([]*model.SimulationTestRecord, 0, batchSize)
|
|
|
+ err = s.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 (s simulationTestRecordDo) FindInBatches(result *[]*model.SimulationTestRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
|
+ return s.DO.FindInBatches(result, batchSize, fc)
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Attrs(attrs ...field.AssignExpr) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Attrs(attrs...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Assign(attrs ...field.AssignExpr) ISimulationTestRecordDo {
|
|
|
+ return s.withDO(s.DO.Assign(attrs...))
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Joins(fields ...field.RelationField) ISimulationTestRecordDo {
|
|
|
+ for _, _f := range fields {
|
|
|
+ s = *s.withDO(s.DO.Joins(_f))
|
|
|
+ }
|
|
|
+ return &s
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Preload(fields ...field.RelationField) ISimulationTestRecordDo {
|
|
|
+ for _, _f := range fields {
|
|
|
+ s = *s.withDO(s.DO.Preload(_f))
|
|
|
+ }
|
|
|
+ return &s
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) FirstOrInit() (*model.SimulationTestRecord, error) {
|
|
|
+ if result, err := s.DO.FirstOrInit(); err != nil {
|
|
|
+ return nil, err
|
|
|
+ } else {
|
|
|
+ return result.(*model.SimulationTestRecord), nil
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) FirstOrCreate() (*model.SimulationTestRecord, error) {
|
|
|
+ if result, err := s.DO.FirstOrCreate(); err != nil {
|
|
|
+ return nil, err
|
|
|
+ } else {
|
|
|
+ return result.(*model.SimulationTestRecord), nil
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) FindByPage(offset int, limit int) (result []*model.SimulationTestRecord, count int64, err error) {
|
|
|
+ result, err = s.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 = s.Offset(-1).Limit(-1).Count()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
|
|
+ count, err = s.Count()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ err = s.Offset(offset).Limit(limit).Scan(result)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Scan(result interface{}) (err error) {
|
|
|
+ return s.DO.Scan(result)
|
|
|
+}
|
|
|
+
|
|
|
+func (s simulationTestRecordDo) Delete(models ...*model.SimulationTestRecord) (result gen.ResultInfo, err error) {
|
|
|
+ return s.DO.Delete(models)
|
|
|
+}
|
|
|
+
|
|
|
+func (s *simulationTestRecordDo) withDO(do gen.Dao) *simulationTestRecordDo {
|
|
|
+ s.DO = *do.(*gen.DO)
|
|
|
+ return s
|
|
|
+}
|