forked from JointCloud/pcm-coordinator
66 lines
2.3 KiB
Go
66 lines
2.3 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
|
|
package models
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
"gorm.io/gorm"
|
|
"strings"
|
|
|
|
"github.com/zeromicro/go-zero/core/stores/builder"
|
|
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
|
"github.com/zeromicro/go-zero/core/stringx"
|
|
)
|
|
|
|
var (
|
|
cloudFieldNames = builder.RawFieldNames(&Cloud{})
|
|
cloudRows = strings.Join(cloudFieldNames, ",")
|
|
cloudRowsExpectAutoSet = strings.Join(stringx.Remove(cloudFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
|
|
cloudRowsWithPlaceHolder = strings.Join(stringx.Remove(cloudFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
|
|
)
|
|
|
|
type (
|
|
cloudModel interface {
|
|
Insert(ctx context.Context, data *Cloud) (sql.Result, error)
|
|
FindOne(ctx context.Context, id int64) (*Cloud, error)
|
|
FindOneByNamespaceNameServiceName(ctx context.Context, namespace sql.NullString, name sql.NullString, serviceName sql.NullString) (*Cloud, error)
|
|
Update(ctx context.Context, data *Cloud) error
|
|
Delete(ctx context.Context, id int64) error
|
|
}
|
|
|
|
defaultCloudModel struct {
|
|
conn sqlx.SqlConn
|
|
table string
|
|
}
|
|
|
|
Cloud struct {
|
|
Id int64 `db:"id"` // id
|
|
TaskId int64 `db:"task_id"` // 任务id
|
|
ParticipantId int64 `db:"participant_id"` // 集群静态信息id
|
|
ApiVersion string `db:"api_version"` //api版本
|
|
Name string `db:"name"` // 名称
|
|
Namespace string `db:"namespace"` // 命名空间
|
|
Kind string `db:"kind"` // 种类
|
|
Status string `db:"status"` // 状态
|
|
StartTime string `db:"start_time"` // 开始时间
|
|
RunningTime int64 `db:"running_time"` // 运行时长
|
|
DeletedAt gorm.DeletedAt `gorm:"index"`
|
|
YamlString string `db:"yaml_string"`
|
|
Result string `db:"result"` // 运行结果
|
|
NsID string `db:"ns_id"`
|
|
Replica int32 `db:"replica"`
|
|
}
|
|
)
|
|
|
|
func newCloudModel(conn sqlx.SqlConn) *defaultCloudModel {
|
|
return &defaultCloudModel{
|
|
conn: conn,
|
|
table: "`cloud`",
|
|
}
|
|
}
|
|
|
|
func (m *defaultCloudModel) tableName() string {
|
|
return m.table
|
|
}
|