repo

package
v0.0.0-...-054b70b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2021 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildRepo

type BuildRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewBuildRepo

func NewBuildRepo() *BuildRepo

func (*BuildRepo) Delete

func (r *BuildRepo) Delete(build model.Build) (err error)

func (*BuildRepo) GetBuild

func (r *BuildRepo) GetBuild(id uint) (build model.Build)

func (*BuildRepo) Save

func (r *BuildRepo) Save(build *model.Build) (err error)

func (*BuildRepo) SaveResult

func (r *BuildRepo) SaveResult(buildTo _domain.BuildTo, resultPath string,
	progress _const.BuildProgress, status _const.BuildStatus, msg string)

func (*BuildRepo) SetTimeoutByQueueId

func (r *BuildRepo) SetTimeoutByQueueId(queueId uint)

func (*BuildRepo) Start

func (r *BuildRepo) Start(build model.Build) (err error)

type ClusterRepo

type ClusterRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewClusterRepo

func NewClusterRepo() *ClusterRepo

func (*ClusterRepo) Get

func (r *ClusterRepo) Get(id uint) (cluster model.Cluster)

func (*ClusterRepo) GetByIdent

func (r *ClusterRepo) GetByIdent(ident string) (cluster model.Cluster)

func (*ClusterRepo) Query

func (r *ClusterRepo) Query(keywords string, pageNo, pageSize int) (clusters []model.Cluster, total int64, err error)

func (*ClusterRepo) QueryByImages

func (r *ClusterRepo) QueryByImages(images []uint, ids []uint) (clusterId, backingImageId uint)

func (*ClusterRepo) QueryByType

func (r *ClusterRepo) QueryByType(tp string) (clusters []model.Cluster, err error)

func (*ClusterRepo) QueryIdle

func (r *ClusterRepo) QueryIdle(cluster int) (ret []map[string]uint)

type CommonRepo

type CommonRepo struct {
}

func NewCommonRepo

func NewCommonRepo() *CommonRepo

func (*CommonRepo) Defer

func (r *CommonRepo) Defer(tx *gorm.DB, code *int)

func (*CommonRepo) DropTables

func (r *CommonRepo) DropTables()

DropTables 删除数据表

func (*CommonRepo) Found

func (r *CommonRepo) Found(s *domain.Search) *gorm.DB

Found 查询条件

func (*CommonRepo) FoundByWhere

func (r *CommonRepo) FoundByWhere(fields []*domain.Filed) func(db *gorm.DB) *gorm.DB

FoundByWhere 查询条件

func (*CommonRepo) GetAll

func (r *CommonRepo) GetAll(model interface{}, s *domain.Search) *gorm.DB

GetAll 批量查询

func (*CommonRepo) GetRelations

func (r *CommonRepo) GetRelations(relation string, fs map[string]interface{}) []*domain.Relate

GetRelations 转换前端获取关联关系为 []*Relate

func (*CommonRepo) GetSearch

func (r *CommonRepo) GetSearch(key, search string) *domain.Filed

GetSearch 转换前端查询关系为 *Filed

func (*CommonRepo) IsNotFound

func (r *CommonRepo) IsNotFound(err error) bool

IsNotFound 判断是否是查询不存在错误

func (*CommonRepo) Paginate

func (r *CommonRepo) Paginate(page, pageSize int) func(db *gorm.DB) *gorm.DB

Paginate 分页

func (*CommonRepo) Relation

func (r *CommonRepo) Relation(relates []*domain.Relate) func(db *gorm.DB) *gorm.DB

Relation 加载关联关系

func (*CommonRepo) Update

func (r *CommonRepo) Update(v, d interface{}, id uint) error

Update 更新

type ComputerRepo

type ComputerRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewComputerRepo

func NewComputerRepo() *ComputerRepo

func (*ComputerRepo) AddInstCount

func (r *ComputerRepo) AddInstCount(id uint)

func (*ComputerRepo) Create

func (r *ComputerRepo) Create(computer *model.Computer)

func (*ComputerRepo) Get

func (r *ComputerRepo) Get(id uint) (ret model.Computer)

func (*ComputerRepo) GetByIndent

func (r *ComputerRepo) GetByIndent(ident string) (ret model.Computer)

type ContainerImageRepo

type ContainerImageRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewContainerImageRepo

func NewContainerImageRepo() *ContainerImageRepo

func (*ContainerImageRepo) Get

func (r *ContainerImageRepo) Get(id uint) (image model.ContainerImage)

func (*ContainerImageRepo) GetByEnv

func (r *ContainerImageRepo) GetByEnv(env base.TestEnv) (image model.ContainerImage)

func (*ContainerImageRepo) QueryByBrowser

func (r *ContainerImageRepo) QueryByBrowser(browserType _const.BrowserType, ver string) (ids []int)

func (*ContainerImageRepo) QueryByOs

func (r *ContainerImageRepo) QueryByOs(platform _const.OsPlatform, osType _const.OsType, osLang _const.SysLang) (ids []int)

type ContainerRepo

type ContainerRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewContainerRepo

func NewContainerRepo() *ContainerRepo

func (*ContainerRepo) DestroyMissedContainersStatus

func (r *ContainerRepo) DestroyMissedContainersStatus(containers []string, hostId uint)

func (*ContainerRepo) FailToCreate

func (r *ContainerRepo) FailToCreate(id uint, msg string)

func (*ContainerRepo) GetById

func (r *ContainerRepo) GetById(id uint) (container model.Container)

func (*ContainerRepo) Launch

func (r *ContainerRepo) Launch(container _domain.Container)

func (*ContainerRepo) QueryForDestroy

func (r *ContainerRepo) QueryForDestroy() (containers []model.Container)

func (*ContainerRepo) Register

func (r *ContainerRepo) Register(container _domain.Container) (err error)

func (*ContainerRepo) Save

func (r *ContainerRepo) Save(po model.Container)

func (*ContainerRepo) UpdateStatusByNames

func (r *ContainerRepo) UpdateStatusByNames(containers []string, status _const.VmStatus)

type DeviceRepo

type DeviceRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewDeviceRepo

func NewDeviceRepo() *DeviceRepo

func (*DeviceRepo) Get

func (r *DeviceRepo) Get(id uint) (device model.Device)

func (*DeviceRepo) GetByEnv

func (r *DeviceRepo) GetByEnv(env base.TestEnv) (dev model.Device)

func (*DeviceRepo) GetBySerial

func (r *DeviceRepo) GetBySerial(serial string) (device model.Device)

func (*DeviceRepo) Register

func (r *DeviceRepo) Register(device _domain.DeviceInst) (err error)

type EnvRepo

type EnvRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewEnvRepo

func NewEnvRepo() *EnvRepo

func (*EnvRepo) ListBrowserType

func (r *EnvRepo) ListBrowserType() (list []model.BrowserType)

func (*EnvRepo) ListOsLang

func (r *EnvRepo) ListOsLang() (list []model.OsLang)

func (*EnvRepo) ListOsPlatform

func (r *EnvRepo) ListOsPlatform() (list []model.OsPlatform)

func (*EnvRepo) ListOsType

func (r *EnvRepo) ListOsType() (list []model.OsType)

type ExecRepo

type ExecRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewExecRepo

func NewExecRepo() *ExecRepo

func (*ExecRepo) DeleteInSameGroup

func (r *ExecRepo) DeleteInSameGroup(groupId uint, serials []string) (err error)

func (*ExecRepo) Save

func (r *ExecRepo) Save(queue model.Queue) (err error)

type IsoRepo

type IsoRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewIsoRepo

func NewIsoRepo() *IsoRepo

func (IsoRepo) Get

func (r IsoRepo) Get(id uint) (iso model.Iso)

type PermRepo

type PermRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewPermRepo

func NewPermRepo() *PermRepo

func (*PermRepo) CreatePermission

func (r *PermRepo) CreatePermission(perm *model.Permission) error

CreatePermission create permission

func (*PermRepo) DeletePermissionById

func (r *PermRepo) DeletePermissionById(id uint) error

DeletePermissionById del permission by id

func (*PermRepo) GetAllPermissions

func (r *PermRepo) GetAllPermissions(s *domain.Search) ([]*model.Permission, int64, error)

GetAllPermissions get all permissions

func (*PermRepo) GetPermission

func (r *PermRepo) GetPermission(search *domain.Search) (*model.Permission, error)

GetPermission get permission

func (*PermRepo) NewPermission

func (r *PermRepo) NewPermission() *model.Permission

func (*PermRepo) PermTransform

func (r *PermRepo) PermTransform(perm *model.Permission) *transformer.Permission

func (*PermRepo) PermsTransform

func (r *PermRepo) PermsTransform(perms []*model.Permission) []*transformer.Permission

func (*PermRepo) UpdatePermission

func (r *PermRepo) UpdatePermission(id uint, pj *model.Permission) error

UpdatePermission update permission

type PlanRepo

type PlanRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewPlanRepo

func NewPlanRepo() *PlanRepo

func (*PlanRepo) Query

func (r *PlanRepo) Query(keywords string, pageNo int, pageSize int) (models []model.Plan, total int64)

func (*PlanRepo) Save

func (r *PlanRepo) Save(plan *model.Plan) (err error)

func (*PlanRepo) SetProgress

func (r *PlanRepo) SetProgress(planId uint, progress _const.BuildProgress) (err error)

func (*PlanRepo) SetResult

func (r *PlanRepo) SetResult(planId uint, progress _const.BuildProgress, status _const.BuildStatus) (err error)

type QueueRepo

type QueueRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewQueueRepo

func NewQueueRepo() *QueueRepo

func (*QueueRepo) GetQueue

func (r *QueueRepo) GetQueue(id uint) (queue model.Queue)

func (*QueueRepo) Pending

func (r *QueueRepo) Pending(queueId uint) (err error)

func (*QueueRepo) QueryByTask

func (r *QueueRepo) QueryByTask(taskID uint) (queues []model.Queue)

func (*QueueRepo) QueryForExec

func (r *QueueRepo) QueryForExec() (queues []model.Queue)

func (*QueueRepo) QueryForRetry

func (r *QueueRepo) QueryForRetry() (queues []model.Queue)

func (*QueueRepo) QueryTimeout

func (r *QueueRepo) QueryTimeout() (queueIds []uint)

func (*QueueRepo) Run

func (r *QueueRepo) Run(queue model.Queue) (err error)

func (*QueueRepo) Save

func (r *QueueRepo) Save(queue *model.Queue) (err error)

func (*QueueRepo) SetAndLaunchVm

func (r *QueueRepo) SetAndLaunchVm(queue model.Queue) (err error)

func (*QueueRepo) SetQueueStatus

func (r *QueueRepo) SetQueueStatus(queueId uint, progress _const.BuildProgress, status _const.BuildStatus)

func (*QueueRepo) SetTimeout

func (r *QueueRepo) SetTimeout(queueIds []uint) (err error)

func (*QueueRepo) UpdateVm

func (r *QueueRepo) UpdateVm(queueId, vmId uint, status _const.BuildProgress)

type RoleRepo

type RoleRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewRoleRepo

func NewRoleRepo() *RoleRepo

func (*RoleRepo) DeleteRoleById

func (r *RoleRepo) DeleteRoleById(id uint) error

DeleteRoleById del role by id

func (*RoleRepo) GetAllRoles

func (r *RoleRepo) GetAllRoles(s *domain.Search) ([]*model.Role, int64, error)

GetAllRoles get all roles

func (*RoleRepo) GetRole

func (r *RoleRepo) GetRole(search *domain.Search) (*model.Role, error)

GetRole get role

func (*RoleRepo) NewRole

func (r *RoleRepo) NewRole() *model.Role

type TaskRepo

type TaskRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewTaskRepo

func NewTaskRepo() *TaskRepo

func (*TaskRepo) Save

func (r *TaskRepo) Save(task *model.Task) (err error)

func (*TaskRepo) SetProgress

func (r *TaskRepo) SetProgress(taskId uint, progress _const.BuildProgress) (err error)

func (*TaskRepo) SetResult

func (r *TaskRepo) SetResult(taskId uint, progress _const.BuildProgress, status _const.BuildStatus) (err error)

type TokenRepo

type TokenRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewTokenRepo

func NewTokenRepo() *TokenRepo

func (*TokenRepo) CacheToRedis

func (r *TokenRepo) CacheToRedis(conn *redisUtils.RedisCluster, cred domain.UserCredentials, token string) error

func (*TokenRepo) CleanUserTokenCache

func (r *TokenRepo) CleanUserTokenCache(conn *redisUtils.RedisCluster, rs domain.UserCredentials) error

func (*TokenRepo) DelTokenCache

func (r *TokenRepo) DelTokenCache(conn *redisUtils.RedisCluster, rs domain.UserCredentials, token string) error

func (*TokenRepo) DelUserTokenCache

func (r *TokenRepo) DelUserTokenCache(conn *redisUtils.RedisCluster, rs domain.UserCredentials, token string) error

func (*TokenRepo) GetRedisSession

func (r *TokenRepo) GetRedisSession(conn *redisUtils.RedisCluster, token string) (*domain.UserCredentials, error)

func (*TokenRepo) GetTokenExpire

func (r *TokenRepo) GetTokenExpire(rs domain.UserCredentials) time.Duration

func (*TokenRepo) GetUserScope

func (r *TokenRepo) GetUserScope(userType string) uint64

func (*TokenRepo) GetWebSession

func (r *TokenRepo) GetWebSession(conn *redisUtils.RedisCluster, token string) (*domain.UserCredentials, error)

func (*TokenRepo) IsUserTokenOver

func (r *TokenRepo) IsUserTokenOver(userId string) bool

func (*TokenRepo) SyncUserTokenCache

func (r *TokenRepo) SyncUserTokenCache(conn *redisUtils.RedisCluster, cred domain.UserCredentials, token string) error

func (*TokenRepo) UpdateUserTokenCacheExpire

func (r *TokenRepo) UpdateUserTokenCacheExpire(conn *redisUtils.RedisCluster, rs domain.UserCredentials, token string) error

func (*TokenRepo) UserTokenExpired

func (r *TokenRepo) UserTokenExpired(token string)

type UserRepo

type UserRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewUserRepo

func NewUserRepo() *UserRepo

func (*UserRepo) DeleteUser

func (r *UserRepo) DeleteUser(id uint) error

DeleteUser del user . if user's username is username ,can't del it.

func (*UserRepo) GetAllUsers

func (r *UserRepo) GetAllUsers(s *domain.Search) ([]*model.User, int64, error)

GetAllUsers get all users

func (*UserRepo) GetByToken

func (r *UserRepo) GetByToken(token string) (model.User, error)

func (*UserRepo) GetUser

func (r *UserRepo) GetUser(search *domain.Search) (*model.User, error)

GetUser get user

func (*UserRepo) NewUser

func (r *UserRepo) NewUser() *model.User

func (*UserRepo) UpdateRefreshToken

func (r *UserRepo) UpdateRefreshToken(id uint, token string)

type VmRepo

type VmRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewVmRepo

func NewVmRepo() *VmRepo

func (*VmRepo) FailToCreate

func (r *VmRepo) FailToCreate(id uint, msg string)

func (*VmRepo) GetById

func (r *VmRepo) GetById(id uint) (vm model.Vm)

func (*VmRepo) QueryForDestroy

func (r *VmRepo) QueryForDestroy() (vms []model.Vm)

func (*VmRepo) Register

func (r *VmRepo) Register(vm _domain.Vm) (err error)

func (*VmRepo) Save

func (r *VmRepo) Save(po *model.Vm)

func (*VmRepo) UpdateStatus

func (r *VmRepo) UpdateStatus(vmId uint, status _const.VmStatus)

func (*VmRepo) UpdateStatusByNames

func (r *VmRepo) UpdateStatusByNames(vms []string, status _const.VmStatus)

type VmTemplRepo

type VmTemplRepo struct {
	CommonRepo
	DB *gorm.DB `inject:""`
}

func NewVmTemplRepo

func NewVmTemplRepo() *VmTemplRepo

func (*VmTemplRepo) Create

func (r *VmTemplRepo) Create(templ *model.VmTempl)

func (*VmTemplRepo) Get

func (r *VmTemplRepo) Get(id uint) (templ model.VmTempl)

func (*VmTemplRepo) GetByEnv

func (r *VmTemplRepo) GetByEnv(env base.TestEnv) (templ model.VmTempl)

func (*VmTemplRepo) GetByIdent

func (r *VmTemplRepo) GetByIdent(ident, computer, cluster string) (templ model.VmTempl)

func (*VmTemplRepo) Update

func (r *VmTemplRepo) Update(templ *model.VmTempl) (err error)

func (*VmTemplRepo) UpdateAllSameName

func (r *VmTemplRepo) UpdateAllSameName(templ *model.VmTempl) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL