// 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(&TaskCloud{})
	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 *TaskCloud) (sql.Result, error)
		FindOne(ctx context.Context, id int64) (*TaskCloud, error)
		FindOneByNamespaceNameServiceName(ctx context.Context, namespace sql.NullString, name sql.NullString, serviceName sql.NullString) (*TaskCloud, error)
		Update(ctx context.Context, data *TaskCloud) error
		Delete(ctx context.Context, id int64) error
	}

	defaultCloudModel struct {
		conn  sqlx.SqlConn
		table string
	}

	TaskCloud 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: "`task_cloud`",
	}
}

func (m *defaultCloudModel) tableName() string {
	return m.table
}
