Version: v0.0.0-...-92ef1f4 Latest Latest

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

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




This section is empty.


This section is empty.


func Defer

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


type BackingRepo

type BackingRepo struct {
	DB *gorm.DB `inject:""`

func NewBackingRepo

func NewBackingRepo() *BackingRepo

func (BackingRepo) Get

func (r BackingRepo) Get(id uint) (image model.VmBacking)

func (BackingRepo) ListAll

func (r BackingRepo) ListAll() (pos []*model.VmBacking)

func (BackingRepo) QueryByBrowser

func (r BackingRepo) QueryByBrowser(browserType consts.BrowserType, version string) (ids []uint)

func (BackingRepo) QueryByOs

func (r BackingRepo) QueryByOs(osCategory consts.OsCategory, osType consts.OsType, osLang consts.OsLang,
	backingIdsByBrowser []uint) (backingIds []uint, found bool)

type BaseRepo

type BaseRepo struct {

func NewBaseRepo

func NewBaseRepo() *BaseRepo

func (*BaseRepo) Defer

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

func (*BaseRepo) Found

func (r *BaseRepo) Found(s *commDomain.Search) *gorm.DB

Found 查询条件

func (*BaseRepo) FoundByWhere

func (r *BaseRepo) FoundByWhere(fields []*commDomain.Filed) func(db *gorm.DB) *gorm.DB

FoundByWhere 查询条件

func (*BaseRepo) GetAll

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

GetAll 批量查询

func (*BaseRepo) GetRelations

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

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

func (*BaseRepo) GetSearch

func (r *BaseRepo) GetSearch(key, search string) *commDomain.Filed

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

func (*BaseRepo) IsNotFound

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

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

func (*BaseRepo) Paginate

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

Paginate 分页

func (*BaseRepo) Relation

func (r *BaseRepo) Relation(relates []*commDomain.Relate) func(db *gorm.DB) *gorm.DB

Relation 加载关联关系

func (*BaseRepo) UpdateObj

func (r *BaseRepo) UpdateObj(v, d interface{}, id uint) error

UpdateObj 更新

type BrowserRepo

type BrowserRepo struct {
	DB *gorm.DB `inject:""`

func NewBrowserRepo

func NewBrowserRepo() *BrowserRepo

func (BrowserRepo) ListByBacking

func (r BrowserRepo) ListByBacking(backingId uint) (pos []*model.Browser)

type BuildRepo

type BuildRepo struct {
	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(build domain.Build) (err error)

func (BuildRepo) SetTimeoutByQueueId

func (r BuildRepo) SetTimeoutByQueueId(queueId uint)

func (BuildRepo) Start

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

type CommonRepo

type CommonRepo struct {

func (CommonRepo) FindAssetByOs

func (r CommonRepo) FindAssetByOs(osCategory consts.OsCategory, osType consts.OsType, osLang consts.OsLang,
	items []domain.VmAssert, inIds []uint) (assertIds []uint, found bool)

type DeviceRepo

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

func NewDeviceRepo

func NewDeviceRepo() *DeviceRepo

func (DeviceRepo) GetBySerial

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

func (DeviceRepo) Register

func (r DeviceRepo) Register(device commDomain.DeviceInst) (err error)

type EnvironmentRepo

type EnvironmentRepo struct {
	DB *gorm.DB `inject:""`

func NewEnvRepo

func NewEnvRepo() *EnvironmentRepo

func (*EnvironmentRepo) Get

func (r *EnvironmentRepo) Get(id int) (po model.Environment)

func (*EnvironmentRepo) GetMap

func (r *EnvironmentRepo) GetMap() (mp map[string]interface{}, err error)

type ExecRepo

type ExecRepo struct {
	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 Filed

type Filed struct {
	Condition string      `json:"condition"`
	Key       string      `json:"key"`
	Value     interface{} `json:"value"`

Filed 查询字段结构体

type HistoryRepo

type HistoryRepo struct {
	DB *gorm.DB `inject:""`

func NewHistoryRepo

func NewHistoryRepo() *HistoryRepo

func (*HistoryRepo) Get

func (r *HistoryRepo) Get(id uint) (po model.History)

func (*HistoryRepo) GetBuildHistoriesByTask

func (r *HistoryRepo) GetBuildHistoriesByTask(taskId uint) (histories []domain.BuildHistory)

func (*HistoryRepo) Query

func (r *HistoryRepo) Query(tp consts.EntityType, id uint) (pos []model.History)

func (*HistoryRepo) Save

func (r *HistoryRepo) Save(po *model.History) (err error)

type HostRepo

type HostRepo struct {
	DB *gorm.DB `inject:""`

func NewHostRepo

func NewHostRepo() *HostRepo

func (HostRepo) Get

func (r HostRepo) Get(id uint) (host model.Host)

func (HostRepo) QueryBusy

func (r HostRepo) QueryBusy() (hostIds []uint)

func (HostRepo) QueryByBackings

func (r HostRepo) QueryByBackings(backingIds []uint, busyHostIds []uint) (hostId, backingId uint)

func (HostRepo) QueryUnBusy

func (r HostRepo) QueryUnBusy(busyHostIds []uint, plf consts.Platform, isNative bool) (hostId uint)

func (HostRepo) Register

func (r HostRepo) Register(host model.Host) (po model.Host, err error)

type HostResult

type HostResult struct {
	HostId   uint
	MaxNum   int
	Platform consts.Platform

type IsoRepo

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

func (IsoRepo) Get

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

type PermRepo

type PermRepo struct {
	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 *commDomain.Search) ([]*model.Permission, int64, error)

GetAllPermissions get all permissions

func (*PermRepo) GetPermission

func (r *PermRepo) GetPermission(search *commDomain.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 QueueRepo

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

func NewQueueRepo

func NewQueueRepo() *QueueRepo

func (QueueRepo) GetByVmId

func (r QueueRepo) GetByVmId(vmId uint) (queue model.Queue)

func (QueueRepo) GetQueue

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

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) QueryForTimeout

func (r QueueRepo) QueryForTimeout() (queues []model.Queue)

func (QueueRepo) RemoveOldQueuesByTask

func (r QueueRepo) RemoveOldQueuesByTask(taskId uint)

func (QueueRepo) ResLaunched

func (r QueueRepo) ResLaunched(queueId uint) (err error)

func (QueueRepo) ResPending

func (r QueueRepo) ResPending(queueId uint) (err error)

func (QueueRepo) ResReady

func (r QueueRepo) ResReady(queueId uint) (err error)

func (QueueRepo) Retry

func (r QueueRepo) Retry(queue model.Queue) (err error)

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) SaveResult

func (r QueueRepo) SaveResult(queueId uint, progress consts.BuildProgress, status consts.BuildStatus)

func (QueueRepo) Timeout

func (r QueueRepo) Timeout(id uint) (err error)

func (QueueRepo) UpdateVm

func (r QueueRepo) UpdateVm(queueId, vmId uint)

type Relate

type Relate struct {
	Value string
	Func  interface{}

type RoleRepo

type RoleRepo struct {
	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 *commDomain.Search) ([]*model.Role, int64, error)

GetAllRoles get all roles

func (*RoleRepo) GetRole

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

GetRole get role

func (*RoleRepo) NewRole

func (r *RoleRepo) NewRole() *model.Role
type Search struct {
	Fields    []*Filed  `json:"fields"`
	Relations []*Relate `json:"relations"`
	OrderBy   string    `json:"order_by"`
	Sort      string    `json:"sort"`
	Limit     int       `json:"limit"`
	Offset    int       `json:"offset"`

Search 查询参数结构体

type SumRes

type SumRes struct {
	Total int64 `json:"total"`

type TaskRepo

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

func NewTaskRepo

func NewTaskRepo() *TaskRepo

func (*TaskRepo) Delete

func (r *TaskRepo) Delete(id uint) (err error)

func (*TaskRepo) Disable

func (r *TaskRepo) Disable(id uint) (err error)

func (*TaskRepo) Get

func (r *TaskRepo) Get(id uint) (po model.Task)

func (*TaskRepo) GetDetail

func (r *TaskRepo) GetDetail(id uint) (po model.Task)

func (*TaskRepo) Query

func (r *TaskRepo) Query(keywords, status string, pageNo int, pageSize int) (pos []model.Task, total int64)

func (*TaskRepo) Save

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

func (*TaskRepo) SetDefault

func (r *TaskRepo) SetDefault(id uint) (err error)

func (*TaskRepo) SetProgress

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

func (*TaskRepo) SetResult

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

func (*TaskRepo) Update

func (r *TaskRepo) Update(po *model.Task) (err error)

type TmplRepo

type TmplRepo struct {
	DB *gorm.DB `inject:""`

func NewTmplRepo

func NewTmplRepo() *TmplRepo

func (*TmplRepo) Get

func (r *TmplRepo) Get(id uint) (po model.VmTmpl)

func (TmplRepo) QueryByOs

func (r TmplRepo) QueryByOs(osCategory consts.OsCategory, osType consts.OsType, osLang consts.OsLang) (
	templId uint, found bool)

type TokenRepo

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

func NewTokenRepo

func NewTokenRepo() *TokenRepo

func (*TokenRepo) CacheToRedis

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

func (*TokenRepo) CleanUserTokenCache

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

func (*TokenRepo) DelTokenCache

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

func (*TokenRepo) DelUserTokenCache

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

func (*TokenRepo) GetRedisSession

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

func (*TokenRepo) GetTokenExpire

func (r *TokenRepo) GetTokenExpire(rs bizConst.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) (*bizConst.UserCredentials, error)

func (*TokenRepo) IsUserTokenOver

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

func (*TokenRepo) SyncUserTokenCache

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

func (*TokenRepo) UpdateUserTokenCacheExpire

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

func (*TokenRepo) UserTokenExpired

func (r *TokenRepo) UserTokenExpired(token string)

type UserRepo

type UserRepo struct {
	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) Get

func (r *UserRepo) Get(id uint) (po model.User, err error)

func (*UserRepo) GetAllUsers

func (r *UserRepo) GetAllUsers(s *commDomain.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 *commDomain.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)

func (*UserRepo) UpdateUserDefaultProject

func (r *UserRepo) UpdateUserDefaultProject(userId string, projectId int)

type VmRepo

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

func NewVmRepo

func NewVmRepo() *VmRepo

func (VmRepo) DestroyMissedVmsStatus

func (r VmRepo) DestroyMissedVmsStatus(vms []string, hostId uint)

func (VmRepo) DestroyTimeoutVms

func (r VmRepo) DestroyTimeoutVms()

func (VmRepo) Distroy

func (r VmRepo) Distroy(id uint)

func (VmRepo) FailToCreate

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

func (VmRepo) FailToDistroy

func (r VmRepo) FailToDistroy(id uint)

func (VmRepo) GetById

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

func (VmRepo) GetByMac

func (r VmRepo) GetByMac(mac string) (vm model.Vm)

func (VmRepo) Launch

func (r VmRepo) Launch(vncAddress, imagePath, backingPath string, id uint)

func (VmRepo) Register

func (r VmRepo) Register(vm domain.Vm) (po model.Vm, statusChanged bool, err error)

func (VmRepo) Save

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

func (VmRepo) UpdateStatusByCloudInstId

func (r VmRepo) UpdateStatusByCloudInstId(ids []string, status consts.VmStatus)

func (VmRepo) UpdateStatusByIds

func (r VmRepo) UpdateStatusByIds(ids []uint, status consts.VmStatus)

func (VmRepo) UpdateStatusByNames

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

func (VmRepo) UpdateVmCloudInst

func (r VmRepo) UpdateVmCloudInst(vm model.Vm)

func (VmRepo) UpdateVmName

func (r VmRepo) UpdateVmName(vm model.Vm)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL