pcm-coordinator/model/scnodeavailinfomodel_gen.go

76 lines
3.0 KiB
Go
Executable File

// Code generated by goctl. DO NOT EDIT.
package model
import (
"context"
"database/sql"
"strings"
"time"
"github.com/zeromicro/go-zero/core/stores/builder"
"github.com/zeromicro/go-zero/core/stores/cache"
"github.com/zeromicro/go-zero/core/stores/sqlc"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/core/stringx"
)
var (
scNodeAvailInfoFieldNames = builder.RawFieldNames(&ScNodeAvailInfo{})
scNodeAvailInfoRows = strings.Join(scNodeAvailInfoFieldNames, ",")
scNodeAvailInfoRowsExpectAutoSet = strings.Join(stringx.Remove(scNodeAvailInfoFieldNames, "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
scNodeAvailInfoRowsWithPlaceHolder = strings.Join(stringx.Remove(scNodeAvailInfoFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
cachePcmScNodeAvailInfoIdPrefix = "cache:pcm:scNodeAvailInfo:id:"
)
type (
scNodeAvailInfoModel interface {
Insert(ctx context.Context, data *ScNodeAvailInfo) (sql.Result, error)
FindOne(ctx context.Context, id int64) (*ScNodeAvailInfo, error)
Update(ctx context.Context, data *ScNodeAvailInfo) error
Delete(ctx context.Context, id int64) error
}
defaultScNodeAvailInfoModel struct {
sqlc.CachedConn
table string
}
ScNodeAvailInfo struct {
Id int64 `db:"id"` // id
NodeName string `db:"node_name"` // 节点名称
CpuTotal int64 `db:"cpu_total"` // cpu核数
CpuUsable float64 `db:"cpu_usable"` // cpu可用率
DiskTotal int64 `db:"disk_total"` // 磁盘空间
DiskAvail int64 `db:"disk_avail"` // 磁盘可用空间
MemTotal int64 `db:"mem_total"` // 内存总数
MemAvail int64 `db:"mem_avail"` // 内存可用数
GpuTotal int64 `db:"gpu_total"` // gpu总数
GpuAvail int64 `db:"gpu_avail"` // gpu可用数
ClusterLogicId int64 `db:"cluster_logic_id"` // 集群静态信息id
DeletedFlag int64 `db:"deleted_flag"` // 是否删除
CreatedBy int64 `db:"created_by"` // 创建人
CreatedTime time.Time `db:"created_time"` // 创建时间
UpdatedBy int64 `db:"updated_by"` // 更新人
UpdatedTime time.Time `db:"updated_time"` // 更新时间
}
)
func newScNodeAvailInfoModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultScNodeAvailInfoModel {
return &defaultScNodeAvailInfoModel{
CachedConn: sqlc.NewConn(conn, c, opts...),
table: "`sc_node_avail_info`",
}
}
func (m *defaultScNodeAvailInfoModel) withSession(session sqlx.Session) *defaultScNodeAvailInfoModel {
return &defaultScNodeAvailInfoModel{
CachedConn: m.CachedConn.WithSession(session),
table: "`sc_node_avail_info`",
}
}
func (m *defaultScNodeAvailInfoModel) tableName() string {
return m.table
}