dao

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dbclient 定义数据库操作的方法, orm 等。

Index

Constants

View Source
const BULK_INSERT_CHUNK_SIZE = 3000

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoTestFileTreeNode

type AutoTestFileTreeNode struct {
	dbengine.BaseModel
	Type      apistructs.UnifiedFileTreeNodeType
	Scope     string
	ScopeID   string
	Pinode    string `gorm:"type:bigint(20)"` // root dir 的 pinode 为 "0",表示无 pinode
	Inode     string `gorm:"type:bigint(20)"`
	Name      string
	Desc      string
	CreatorID string
	UpdaterID string
}

Inode / Pinode 使用 snowflake uuid

func (AutoTestFileTreeNode) TableName

func (AutoTestFileTreeNode) TableName() string

type AutoTestFileTreeNodeHistory

type AutoTestFileTreeNodeHistory struct {
	dbengine.BaseModel
	Pinode        string                        `gorm:"type:bigint(20)"` // root dir 的 pinode 为 "0",表示无 pinode
	Inode         string                        `gorm:"type:bigint(20)"`
	Name          string                        `gorm:"name"`
	Desc          string                        `gorm:"desc"`
	CreatorID     string                        `gorm:"creator_id"`
	UpdaterID     string                        `gorm:"updater_id"`
	PipelineYml   string                        `gorm:"pipeline_yml"`   // 节点的 pipeline yml 文件,pipeline 可以通过 snippetAction 配置
	SnippetAction snippetActionType             `gorm:"snippet_action"` // 其他用例或计划通过 snippet 方式引用时当前节点时, 根据该参数拼装出 snippet action
	Extra         autoTestFileTreeNodeMetaExtra `gorm:"extra"`
}

func (AutoTestFileTreeNodeHistory) TableName

func (AutoTestFileTreeNodeHistory) TableName() string

type AutoTestFileTreeNodeMeta

type AutoTestFileTreeNodeMeta struct {
	dbengine.BaseModel
	Inode         string            `gorm:"type:bigint(20)"`
	PipelineYml   string            // 节点的 pipeline yml 文件,pipeline 可以通过 snippetAction 配置
	SnippetAction snippetActionType // 其他用例或计划通过 snippet 方式引用时当前节点时, 根据该参数拼装出 snippet action
	Extra         autoTestFileTreeNodeMetaExtra
}

func (AutoTestFileTreeNodeMeta) TableName

func (AutoTestFileTreeNodeMeta) TableName() string

type AutoTestPlanMember

type AutoTestPlanMember struct {
	dbengine.BaseModel
	TestPlanID uint64                        `json:"testPlanID"`
	Role       apistructs.TestPlanMemberRole `json:"role"`
	UserID     string                        `json:"userID"`
}

AutoTestPlanMember 自动测试计划成员表

func (AutoTestPlanMember) TableName

func (AutoTestPlanMember) TableName() string

type AutoTestScene

type AutoTestScene struct {
	dbengine.BaseModel
	Name        string                 `gorm:"name"`
	Description string                 `gorm:"description"` // 描述
	SpaceID     uint64                 `gorm:"space_id"`    // 场景所属测试空间ID
	SetID       uint64                 `gorm:"set_id"`      // 场景集ID
	PreID       uint64                 `gorm:"pre_id"`      // 排序的前驱ID
	CreatorID   string                 `gorm:"creator_id"`
	UpdaterID   string                 `gorm:"updater_id"`
	Status      apistructs.SceneStatus `gorm:"status"`
	RefSetID    uint64                 `gorm:"ref_set_id"` // 引用场景集ID
}

func (*AutoTestScene) Convert

func (s *AutoTestScene) Convert() apistructs.AutoTestScene

func (AutoTestScene) TableName

func (AutoTestScene) TableName() string

type AutoTestSceneInput

type AutoTestSceneInput struct {
	dbengine.BaseModel
	Name        string `gorm:"name"`
	Value       string `gorm:"value"`       // 默认值
	Temp        string `gorm:"temp"`        // 当前值
	Description string `gorm:"description"` // 描述
	SceneID     uint64 `gorm:"scene_id"`    // 场景ID
	SpaceID     uint64 `gorm:"space_id"`    // 所属测试空间ID
	CreatorID   string `gorm:"creator_id"`
	UpdaterID   string `gorm:"updater_id"`
}

func (AutoTestSceneInput) TableName

func (AutoTestSceneInput) TableName() string

type AutoTestSceneOutput

type AutoTestSceneOutput struct {
	dbengine.BaseModel
	Name        string `gorm:"name"`
	Value       string `gorm:"value"`       // 值表达式
	Description string `gorm:"description"` // 描述
	SceneID     uint64 `gorm:"scene_id"`    // 场景ID
	SpaceID     uint64 `gorm:"space_id"`    // 所属测试空间ID
	CreatorID   string `gorm:"creator_id"`
	UpdaterID   string `gorm:"updater_id"`
}

func (AutoTestSceneOutput) TableName

func (AutoTestSceneOutput) TableName() string

type AutoTestSceneStep

type AutoTestSceneStep struct {
	dbengine.BaseModel
	Type      apistructs.StepAPIType `gorm:"type"`               // 类型
	Value     string                 `gorm:"value"`              // 值
	Name      string                 `gorm:"name"`               // 名称
	PreID     uint64                 `gorm:"pre_id"`             // 排序id
	PreType   apistructs.PreType     `gorm:"pre_type"`           // 串行/并行类型
	SceneID   uint64                 `gorm:"scene_id"`           // 场景ID
	SpaceID   uint64                 `gorm:"space_id"`           // 所属测试空间ID
	APISpecID uint64                 `gorm:"column:api_spec_id"` // api集市id
	CreatorID string                 `gorm:"creator_id"`
	UpdaterID string                 `gorm:"updater_id"`
}

func (*AutoTestSceneStep) Convert

func (AutoTestSceneStep) TableName

func (AutoTestSceneStep) TableName() string

type AutoTestSpace

type AutoTestSpace struct {
	dbengine.BaseModel
	Name        string
	ProjectID   int64
	Description string
	CreatorID   string
	UpdaterID   string
	Status      apistructs.AutoTestSpaceStatus
	// 被复制的源测试空间
	SourceSpaceID *uint64
	// DeletedAt 删除时间
	DeletedAt *time.Time
}

AutoTestSpace 测试空间

func (AutoTestSpace) TableName

func (AutoTestSpace) TableName() string

TableName 表名

type DBClient

type DBClient struct {
	*dbengine.DBEngine
}

func Open

func Open() (*DBClient, error)

func (*DBClient) AddTestPlanV2Step

func (client *DBClient) AddTestPlanV2Step(req *apistructs.TestPlanV2StepAddRequest) error

AddTestPlanV2Step Insert a step in the test plan

func (*DBClient) BatchCopyTestCases

func (client *DBClient) BatchCopyTestCases(req apistructs.TestCaseBatchCopyRequest) error

func (*DBClient) BatchCreateAutoTestPlanMembers

func (client *DBClient) BatchCreateAutoTestPlanMembers(members []AutoTestPlanMember) error

func (*DBClient) BatchCreateIssueTestCaseRelations

func (client *DBClient) BatchCreateIssueTestCaseRelations(rels []IssueTestCaseRelation) error

BatchCreateIssueTestCaseRelations 批量创建关联关系

func (*DBClient) BatchCreateTestPlanCaseRels

func (client *DBClient) BatchCreateTestPlanCaseRels(rels []TestPlanCaseRel) error

func (*DBClient) BatchCreateTestPlanMembers

func (client *DBClient) BatchCreateTestPlanMembers(members []TestPlanMember) error

func (*DBClient) BatchDeleteSonarMetricRules

func (client *DBClient) BatchDeleteSonarMetricRules(rules []QASonarMetricRules) (err error)

func (*DBClient) BatchDeleteTestCases

func (client *DBClient) BatchDeleteTestCases(ids []uint64) error

func (*DBClient) BatchInsertSonarMetricRules

func (client *DBClient) BatchInsertSonarMetricRules(rules []*QASonarMetricRules) (err error)

func (*DBClient) BatchUpdateTestCases

func (client *DBClient) BatchUpdateTestCases(req apistructs.TestCaseBatchUpdateRequest) error

func (*DBClient) BatchUpdateTestPlanCaseRels

func (client *DBClient) BatchUpdateTestPlanCaseRels(req apistructs.TestPlanCaseRelBatchUpdateRequest) error

BatchUpdateTestPlanCaseRels 批量更新测试计划用例

func (*DBClient) BulkInsert

func (db *DBClient) BulkInsert(objects interface{}, excludeColumns ...string) error

func (*DBClient) CheckRelatedSceneSet

func (client *DBClient) CheckRelatedSceneSet(setId uint64) (bool, error)

func (*DBClient) CheckSceneSetIsExists

func (client *DBClient) CheckSceneSetIsExists(setID uint64) error

CheckSceneSetIsExists check the SceneSet is exists

func (*DBClient) CheckTestPlanCaseRelIDsExistOrNot

func (client *DBClient) CheckTestPlanCaseRelIDsExistOrNot(planID uint64, caseIDs []uint64) ([]uint64, []uint64, error)

CheckTestPlanCaseRelIDsExistOrNot 返回已存在和不存在的 id 列表 return: existIDs, notExistIDs, error

func (*DBClient) CheckTestPlanV2NameExist

func (client *DBClient) CheckTestPlanV2NameExist(name string) error

CheckTestPlanV2NameExist Check if the name of the test plan is repeated

func (*DBClient) CleanTestCasesByTestSetID

func (client *DBClient) CleanTestCasesByTestSetID(projectID, testSetID uint64) error

CleanTestCasesByTestSetID 彻底删除测试集下的测试用例

func (*DBClient) CleanTestSetFromRecycleBin

func (db *DBClient) CleanTestSetFromRecycleBin(testSetID uint64) error

func (*DBClient) Close

func (db *DBClient) Close() error

func (*DBClient) CopyAutoTestSceneStep

func (db *DBClient) CopyAutoTestSceneStep(req apistructs.AutotestSceneRequest) error

func (*DBClient) CountSceneBySetAndName

func (db *DBClient) CountSceneBySetAndName(setId uint64, name string) (int, error)

func (*DBClient) CountSceneBySetID

func (db *DBClient) CountSceneBySetID(setId uint64) (uint64, error)

func (*DBClient) CountSceneBySpaceID

func (db *DBClient) CountSceneBySpaceID(spaceID uint64) (uint64, error)

func (*DBClient) CountSceneSetByName

func (client *DBClient) CountSceneSetByName(name string, spaceId uint64) (int, error)

func (*DBClient) CreateAutoTestFileTreeNode

func (db *DBClient) CreateAutoTestFileTreeNode(node *AutoTestFileTreeNode) error

func (*DBClient) CreateAutoTestFileTreeNodeHistory

func (db *DBClient) CreateAutoTestFileTreeNodeHistory(node *AutoTestFileTreeNodeHistory) error

func (*DBClient) CreateAutoTestFileTreeNodeMeta

func (db *DBClient) CreateAutoTestFileTreeNodeMeta(meta *AutoTestFileTreeNodeMeta) error

func (*DBClient) CreateAutoTestPlanMember

func (client *DBClient) CreateAutoTestPlanMember(mem *AutoTestPlanMember) error

func (*DBClient) CreateAutoTestSceneInput

func (db *DBClient) CreateAutoTestSceneInput(input *AutoTestSceneInput) error

func (*DBClient) CreateAutoTestSceneInputs

func (db *DBClient) CreateAutoTestSceneInputs(input []AutoTestSceneInput) error

func (*DBClient) CreateAutoTestSceneOutput

func (db *DBClient) CreateAutoTestSceneOutput(output *AutoTestSceneOutput) error

func (*DBClient) CreateAutoTestSceneOutputs

func (db *DBClient) CreateAutoTestSceneOutputs(output []AutoTestSceneOutput) error

func (*DBClient) CreateAutoTestSceneStep

func (db *DBClient) CreateAutoTestSceneStep(step *AutoTestSceneStep) error

func (*DBClient) CreateAutoTestSpace

func (db *DBClient) CreateAutoTestSpace(space *AutoTestSpace) (*AutoTestSpace, error)

CreateAutoTestSpace 创建测试空间

func (*DBClient) CreateAutotestScene

func (db *DBClient) CreateAutotestScene(node *AutoTestScene) error

func (*DBClient) CreateOrUpdateAutoTestFileTreeNodeMetaAddExtraByInode

func (db *DBClient) CreateOrUpdateAutoTestFileTreeNodeMetaAddExtraByInode(inode string, addExtra map[string]interface{}) error

func (*DBClient) CreateOrUpdateAutoTestFileTreeNodeMetaPipelineYmlAndSnippetObjByInode

func (db *DBClient) CreateOrUpdateAutoTestFileTreeNodeMetaPipelineYmlAndSnippetObjByInode(inode, pipelineYml string, snippetAction apistructs.PipelineYmlAction) error

func (*DBClient) CreateSceneSet

func (client *DBClient) CreateSceneSet(sceneSet *SceneSet) error

Create Scene Set

func (*DBClient) CreateTestCase

func (client *DBClient) CreateTestCase(uc *TestCase) error

CreateTestCase 创建测试用例

func (*DBClient) CreateTestPlan

func (client *DBClient) CreateTestPlan(testPlan *TestPlan) error

CreateTestPlan Create test plan

func (*DBClient) CreateTestPlanCaseRel

func (client *DBClient) CreateTestPlanCaseRel(testPlanCaseRel *TestPlanCaseRel) error

CreateTestPlanCaseRel Create testPlanCaseRel

func (*DBClient) CreateTestPlanMember

func (client *DBClient) CreateTestPlanMember(mem *TestPlanMember) error

func (*DBClient) CreateTestPlanV2

func (client *DBClient) CreateTestPlanV2(testPlan *TestPlanV2) error

CreateTestPlanV2 Create test plan

func (*DBClient) CreateTestSet

func (db *DBClient) CreateTestSet(testset *TestSet) error

CreateTestSet insert testset

func (*DBClient) DeleteAutoTestFileTreeNodeByInode

func (db *DBClient) DeleteAutoTestFileTreeNodeByInode(inode string) error

func (*DBClient) DeleteAutoTestFileTreeNodeHistory

func (db *DBClient) DeleteAutoTestFileTreeNodeHistory(node *AutoTestFileTreeNodeHistory) error

func (*DBClient) DeleteAutoTestPlanMemberByPlanID

func (client *DBClient) DeleteAutoTestPlanMemberByPlanID(planID uint64) error

func (*DBClient) DeleteAutoTestScene

func (db *DBClient) DeleteAutoTestScene(id uint64) error

func (*DBClient) DeleteAutoTestSceneInput

func (db *DBClient) DeleteAutoTestSceneInput(id uint64) error

func (*DBClient) DeleteAutoTestSceneOutput

func (db *DBClient) DeleteAutoTestSceneOutput(id uint64) error

func (*DBClient) DeleteAutoTestSceneStep

func (db *DBClient) DeleteAutoTestSceneStep(id uint64) error

func (*DBClient) DeleteAutoTestSpace

func (db *DBClient) DeleteAutoTestSpace(space *AutoTestSpace) (*AutoTestSpace, error)

DeleteAutoTestSpace 删除测试空间

func (*DBClient) DeleteAutoTestSpaceRelation

func (db *DBClient) DeleteAutoTestSpaceRelation(spaceID uint64) error

DeleteAutoTestSpaceRelation 删除测试空间关联

func (*DBClient) DeleteIssueTestCaseRelationsByIDs

func (client *DBClient) DeleteIssueTestCaseRelationsByIDs(ids []uint64) error

DeleteIssueTestCaseRelationsByIDs 根据关联关系 id 删除

func (*DBClient) DeleteIssueTestCaseRelationsByIssueIDs

func (client *DBClient) DeleteIssueTestCaseRelationsByIssueIDs(issueIDs []uint64) error

DeleteIssueTestCaseRelationsByIssueIDs 根据 issue ids 删除关联关系

func (*DBClient) DeleteIssueTestCaseRelationsByTestCaseIDs

func (client *DBClient) DeleteIssueTestCaseRelationsByTestCaseIDs(testCaseIds []uint64) error

DeleteIssueTestCaseRelationsByCaseIDs 根据 test case id 删除关联关系

func (*DBClient) DeleteIssueTestCaseRelationsByTestPlanCaseRelIDs

func (client *DBClient) DeleteIssueTestCaseRelationsByTestPlanCaseRelIDs(testPlanCaseRelIDs []uint64) error

DeleteIssueTestCaseRelationsByTestPlanCaseRelIDs 根据 测试计划用例 ids 删除

func (*DBClient) DeleteSceneSet

func (client *DBClient) DeleteSceneSet(sceneSet *SceneSet, scenes []uint64) error

Delete Sceneset

func (*DBClient) DeleteTestPlan

func (client *DBClient) DeleteTestPlan(testPlanID uint64) error

DeleteTestPlan Delete test plan

func (*DBClient) DeleteTestPlanCaseRelByTestCaseID

func (client *DBClient) DeleteTestPlanCaseRelByTestCaseID(testCaseID uint64) error

DeleteTestPlanCaseRelByTestCaseID Delete relations by testCaseID

func (*DBClient) DeleteTestPlanCaseRelByTestPlanID

func (client *DBClient) DeleteTestPlanCaseRelByTestPlanID(testPlanID uint64) error

DeleteTestPlanCaseRelByTestPlanID Delete relations by testPlanID

func (*DBClient) DeleteTestPlanCaseRelations

func (client *DBClient) DeleteTestPlanCaseRelations(testPlanID uint64, relIDs []uint64) error

DeleteTestPlanCaseRelations

func (*DBClient) DeleteTestPlanCaseRelationsByTestCaseIds

func (client *DBClient) DeleteTestPlanCaseRelationsByTestCaseIds(testCaseIds []uint64) error

DeleteTestPlanCaseRelationsByTestCaseIds

func (*DBClient) DeleteTestPlanMemberByPlanID

func (client *DBClient) DeleteTestPlanMemberByPlanID(planID uint64) error

func (*DBClient) DeleteTestPlanV2ByID

func (client *DBClient) DeleteTestPlanV2ByID(testPlanID uint64) error

DeleteTestPlanV2ByID Delete test plan and his all steps by ID

func (*DBClient) DeleteTestPlanV2Step

func (client *DBClient) DeleteTestPlanV2Step(req *apistructs.TestPlanV2StepDeleteRequest) error

DeleteTestPlanV2Step Delete a step in the test plan

func (*DBClient) FindByPreId

func (client *DBClient) FindByPreId(id uint64) (*SceneSet, error)

func (*DBClient) FuzzySearchAutoTestFileTreeNodes

func (db *DBClient) FuzzySearchAutoTestFileTreeNodes(scope, scopeID string, prefixFuzzy, suffixFuzzy, fuzzy string, pinodes []string, creatorID string) ([]AutoTestFileTreeNode, error)

func (*DBClient) GetAllTestSets

func (db *DBClient) GetAllTestSets() ([]TestSet, error)

func (*DBClient) GetAutoTestFileTreeNodeByInode

func (db *DBClient) GetAutoTestFileTreeNodeByInode(inode string) (*AutoTestFileTreeNode, bool, error)

func (*DBClient) GetAutoTestFileTreeNodeMetaByInode

func (db *DBClient) GetAutoTestFileTreeNodeMetaByInode(inode string) (*AutoTestFileTreeNodeMeta, bool, error)

func (*DBClient) GetAutoTestFileTreeScopeRootDir

func (db *DBClient) GetAutoTestFileTreeScopeRootDir(scope, scopeID string) (*AutoTestFileTreeNode, bool, error)

func (*DBClient) GetAutoTestSceneInput

func (db *DBClient) GetAutoTestSceneInput(id uint64) (*AutoTestSceneInput, error)

func (*DBClient) GetAutoTestSceneOutput

func (db *DBClient) GetAutoTestSceneOutput(id uint64) (*AutoTestSceneOutput, error)

func (*DBClient) GetAutoTestScenePreByPosition

func (db *DBClient) GetAutoTestScenePreByPosition(req apistructs.AutotestSceneRequest) (uint64, uint64, bool, error)

func (*DBClient) GetAutoTestSceneStep

func (db *DBClient) GetAutoTestSceneStep(id uint64) (*AutoTestSceneStep, error)

func (*DBClient) GetAutoTestSceneStepByPreID

func (db *DBClient) GetAutoTestSceneStepByPreID(preID uint64, preType apistructs.PreType) (*AutoTestSceneStep, error)

func (*DBClient) GetAutoTestSceneStepCount

func (db *DBClient) GetAutoTestSceneStepCount(sceneID []uint64) ([]GetNum, error)

func (*DBClient) GetAutoTestSceneStepNumber

func (db *DBClient) GetAutoTestSceneStepNumber(sceneID uint64) (uint64, error)

func (*DBClient) GetAutoTestSpace

func (db *DBClient) GetAutoTestSpace(id uint64) (*AutoTestSpace, error)

GetAutoTestSpace 获取测试空间

func (*DBClient) GetAutoTestSpaceStepNumber

func (db *DBClient) GetAutoTestSpaceStepNumber(spaceID uint64) (uint64, error)

func (*DBClient) GetAutotestScene

func (db *DBClient) GetAutotestScene(id uint64) (*AutoTestScene, error)

func (*DBClient) GetAutotestSceneByName

func (db *DBClient) GetAutotestSceneByName(name string, setID uint64) (*AutoTestScene, error)

func (*DBClient) GetAutotestSceneByPreID

func (db *DBClient) GetAutotestSceneByPreID(preID uint64) (*AutoTestScene, error)

func (*DBClient) GetAutotestSceneFirst

func (db *DBClient) GetAutotestSceneFirst(setID uint64) (*AutoTestScene, error)

func (*DBClient) GetAutotestSpaceByName

func (db *DBClient) GetAutotestSpaceByName(name string, projectID int64) (*AutoTestSpace, error)

GetAutotestSpaceByName 通过空间名获取空间

func (*DBClient) GetMaxOrderNumUnderParentTestSet

func (db *DBClient) GetMaxOrderNumUnderParentTestSet(projectID, parentID uint64, recycled bool) (int, error)

GetMaxOrderNumUnderParentTestSet 返回当前父测试集下的最大 order num 若当前父测试集下没有子测试集,则返回 -1

func (*DBClient) GetSceneSet

func (client *DBClient) GetSceneSet(id uint64) (*SceneSet, error)

Get Sceneset by id

func (*DBClient) GetSceneSetByPreID

func (client *DBClient) GetSceneSetByPreID(preID uint64) (*SceneSet, error)

func (*DBClient) GetSonarMetricRules

func (client *DBClient) GetSonarMetricRules(ID int64) (*QASonarMetricRules, error)

func (*DBClient) GetStepByTestPlanID

func (client *DBClient) GetStepByTestPlanID(testPlanID uint64, needSort bool) ([]TestPlanV2StepJoin, int64, error)

GetStepByTestPlanID Get steps of test plan if needSort is true then return a sorted list

func (*DBClient) GetTestCaseByID

func (client *DBClient) GetTestCaseByID(id uint64) (*TestCase, error)

func (*DBClient) GetTestPlan

func (client *DBClient) GetTestPlan(testPlanID uint64) (*TestPlan, error)

GetTestPlan Fetch test plan

func (*DBClient) GetTestPlanByName

func (client *DBClient) GetTestPlanByName(projectID uint64, name string) (*TestPlan, error)

GetTestPlanByName

func (*DBClient) GetTestPlanCaseRel

func (client *DBClient) GetTestPlanCaseRel(relID uint64) (*TestPlanCaseRel, error)

GetTestPlanCaseRel Fetch testPlanCaseRel

func (*DBClient) GetTestPlanCaseRelByPlanIDAndCaseID

func (client *DBClient) GetTestPlanCaseRelByPlanIDAndCaseID(planID, caseID uint64) (*TestPlanCaseRel, error)

func (*DBClient) GetTestPlanV2ByID

func (client *DBClient) GetTestPlanV2ByID(testPlanID uint64) (*TestPlanV2, error)

GetTestPlanV2ByID Get test plan by id

func (*DBClient) GetTestPlanV2Step

func (client *DBClient) GetTestPlanV2Step(ID uint64) (*TestPlanV2StepJoin, error)

func (*DBClient) GetTestPlanV2StepByPreID

func (client *DBClient) GetTestPlanV2StepByPreID(preID uint64) (*TestPlanV2Step, error)

func (*DBClient) GetTestSetByID

func (db *DBClient) GetTestSetByID(id uint64) (*TestSet, error)

GetTestSetByID 根据ID获取测试集

func (*DBClient) GetTestSetByNameAndParentIDAndProjectID

func (db *DBClient) GetTestSetByNameAndParentIDAndProjectID(projectID, parentID uint64, recycled bool, name string) (*TestSet, error)

ListTestSets 根据父ID和项目ID获取测试集

func (*DBClient) GetTestSetByParentID

func (db *DBClient) GetTestSetByParentID(parentID, projectID uint64) (*[]TestSet, error)

GetTestSetByParentID 根据父ID和项目ID获取测试集

func (*DBClient) GetTestSetByParentIDAndProjectIDAsc

func (db *DBClient) GetTestSetByParentIDAndProjectIDAsc(parentIDs []uint64, projectID uint64, recycled bool, testSetIDs []uint64) ([]TestSet, error)

GetTestSetByParentIDAndProjectIDAsc 根据父ID和项目ID获取子测试集信息,升序排列

func (*DBClient) GetTestSetByParentIDsAndProjectID

func (db *DBClient) GetTestSetByParentIDsAndProjectID(parentIDs []uint64, projectID uint64, recycled bool) ([]TestSet, error)

GetTestSetByParentIDsAndProjectID 根据父ID和项目ID获取测试集

func (*DBClient) GetTestSetDirectoryByID

func (db *DBClient) GetTestSetDirectoryByID(id uint64) (string, error)

GetTestSetDirectoryByID 根据ID获取测试集的路径

func (*DBClient) GetUserAutoTestPlanRole

func (client *DBClient) GetUserAutoTestPlanRole(userID string, testPlanID uint64) (apistructs.TestPlanMemberRole, error)

func (*DBClient) GetUserTestPlanRole

func (client *DBClient) GetUserTestPlanRole(userID string, testPlanID uint64) (apistructs.TestPlanMemberRole, error)

func (*DBClient) Insert

func (db *DBClient) Insert(scene *AutoTestScene, id uint64) error

func (*DBClient) InsertAutoTestSceneStep

func (db *DBClient) InsertAutoTestSceneStep(req apistructs.AutotestSceneRequest, preID uint64) (uint64, error)

func (*DBClient) ListAutoTestFileTreeNodeByPinode

func (db *DBClient) ListAutoTestFileTreeNodeByPinode(pinode string) ([]AutoTestFileTreeNode, error)

func (*DBClient) ListAutoTestFileTreeNodeByPinodeAndNamePrefix

func (db *DBClient) ListAutoTestFileTreeNodeByPinodeAndNamePrefix(pinode, namePrefix string) ([]AutoTestFileTreeNode, error)

func (*DBClient) ListAutoTestFileTreeNodeHistoryByinode

func (db *DBClient) ListAutoTestFileTreeNodeHistoryByinode(inode string) ([]AutoTestFileTreeNodeHistory, error)

func (*DBClient) ListAutoTestPlanMembersByPlanID

func (client *DBClient) ListAutoTestPlanMembersByPlanID(testPlanID uint64, roles ...apistructs.TestPlanMemberRole) ([]AutoTestPlanMember, error)

func (*DBClient) ListAutoTestPlanMembersByPlanIDs

func (client *DBClient) ListAutoTestPlanMembersByPlanIDs(testPlanIDs []uint64, roles ...apistructs.TestPlanMemberRole) (map[uint64][]AutoTestPlanMember, error)

func (*DBClient) ListAutoTestPlanOwnersByOwners

func (client *DBClient) ListAutoTestPlanOwnersByOwners(owners []string) ([]AutoTestPlanMember, error)

func (*DBClient) ListAutoTestPlanOwnersByPlanID

func (client *DBClient) ListAutoTestPlanOwnersByPlanID(testPlanID uint64) ([]AutoTestPlanMember, error)

func (*DBClient) ListAutoTestSceneInput

func (db *DBClient) ListAutoTestSceneInput(sceneID uint64) ([]AutoTestSceneInput, error)

func (*DBClient) ListAutoTestSceneInputByScenes

func (db *DBClient) ListAutoTestSceneInputByScenes(sceneID []uint64) ([]AutoTestSceneInput, error)

func (*DBClient) ListAutoTestSceneOutput

func (db *DBClient) ListAutoTestSceneOutput(sceneID uint64) ([]AutoTestSceneOutput, error)

func (*DBClient) ListAutoTestSceneOutputByScenes

func (db *DBClient) ListAutoTestSceneOutputByScenes(sceneID []uint64) ([]AutoTestSceneOutput, error)

func (*DBClient) ListAutoTestSceneStep

func (db *DBClient) ListAutoTestSceneStep(sceneID uint64) ([]AutoTestSceneStep, error)

func (*DBClient) ListAutoTestSceneSteps

func (db *DBClient) ListAutoTestSceneSteps(sceneID []uint64) ([]AutoTestSceneStep, error)

func (*DBClient) ListAutoTestSpaceByProject

func (db *DBClient) ListAutoTestSpaceByProject(projectID int64, pageNo, pageSize int) ([]AutoTestSpace, int, error)

ListAutoTestSpaceByProject 项目下获取测试空间列表

func (*DBClient) ListAutotestScene

func (db *DBClient) ListAutotestScene(req apistructs.AutotestSceneRequest) (uint64, []AutoTestScene, error)

func (*DBClient) ListAutotestScenes

func (db *DBClient) ListAutotestScenes(setIDs []uint64) ([]AutoTestScene, error)

ListAutotestScenes 批量查询场景

func (*DBClient) ListIssueTestCaseRelations

func (client *DBClient) ListIssueTestCaseRelations(req apistructs.IssueTestCaseRelationsListRequest) ([]IssueTestCaseRelation, error)

ListIssueTestCaseRelations 查询事件用例关联关系列表

func (*DBClient) ListSonarMetricRules

func (client *DBClient) ListSonarMetricRules(query *QASonarMetricRules, otherQueryFuncList ...func(sql *gorm.DB) *gorm.DB) (dbRules []QASonarMetricRules, err error)

func (*DBClient) ListTestCasesByIDs

func (client *DBClient) ListTestCasesByIDs(ids []uint64) ([]TestCase, error)

func (*DBClient) ListTestCasesByTestSetIDs

func (client *DBClient) ListTestCasesByTestSetIDs(req apistructs.TestCaseListRequest) ([]TestCase, error)

func (*DBClient) ListTestPlanCaseRels

func (client *DBClient) ListTestPlanCaseRels(req apistructs.TestPlanCaseRelListRequest) ([]TestPlanCaseRel, error)

ListTestPlanCaseRels List testPlanCaseRel

func (*DBClient) ListTestPlanCaseRelsCount

func (client *DBClient) ListTestPlanCaseRelsCount(testPlanIDs []uint64) (map[uint64]apistructs.TestPlanRelsCount, error)

func (*DBClient) ListTestPlanIDsByOwnerIDs

func (client *DBClient) ListTestPlanIDsByOwnerIDs(ownerIDs []string) ([]uint64, error)

func (*DBClient) ListTestPlanIDsByPartnerIDs

func (client *DBClient) ListTestPlanIDsByPartnerIDs(partnerIDs []string) ([]uint64, error)

func (*DBClient) ListTestPlanIDsByUserIDs

func (client *DBClient) ListTestPlanIDsByUserIDs(userIDs []string, roles ...apistructs.TestPlanMemberRole) ([]uint64, error)

func (*DBClient) ListTestPlanMembersByPlanID

func (client *DBClient) ListTestPlanMembersByPlanID(testPlanID uint64, roles ...apistructs.TestPlanMemberRole) ([]TestPlanMember, error)

func (*DBClient) ListTestPlanMembersByPlanIDs

func (client *DBClient) ListTestPlanMembersByPlanIDs(testPlanIDs []uint64, roles ...apistructs.TestPlanMemberRole) (map[uint64][]TestPlanMember, error)

func (*DBClient) ListTestPlanOwnersByOwners

func (client *DBClient) ListTestPlanOwnersByOwners(owners []string) ([]TestPlanMember, error)

func (*DBClient) ListTestPlanOwnersByPlanID

func (client *DBClient) ListTestPlanOwnersByPlanID(testPlanID uint64) ([]TestPlanMember, error)

func (*DBClient) ListTestPlanPartnersByPlanID

func (client *DBClient) ListTestPlanPartnersByPlanID(testPlanID uint64) ([]TestPlanMember, error)

func (*DBClient) ListTestPlanTestSetIDs

func (client *DBClient) ListTestPlanTestSetIDs(testPlanID uint64) ([]uint64, error)

ListTestPlanTestSetIDs 获取测试计划下的测试集 ID 列表,从关联关系而来

func (*DBClient) ListTestSetByIDs

func (db *DBClient) ListTestSetByIDs(ids []uint64) ([]TestSet, error)

func (*DBClient) ListTestSets

func (db *DBClient) ListTestSets(req apistructs.TestSetListRequest) ([]TestSet, error)

ListTestSets

func (*DBClient) ListTestSetsRecursive

func (db *DBClient) ListTestSetsRecursive(req apistructs.TestSetListRequest) ([]uint64, []TestSet, error)

ListTestSetsRecursive 获取测试集列表,可选是否包含子测试集

func (*DBClient) MoveAutoTestFileTreeNode

func (db *DBClient) MoveAutoTestFileTreeNode(inode, pinode, name, updaterID string) error

func (*DBClient) MoveAutoTestScene

func (db *DBClient) MoveAutoTestScene(id, preID, setID uint64) error

func (*DBClient) MoveAutoTestSceneStep

func (db *DBClient) MoveAutoTestSceneStep(req apistructs.AutotestSceneRequest) error

单个移动

func (*DBClient) MoveAutoTestSceneStepGroup

func (db *DBClient) MoveAutoTestSceneStepGroup(req apistructs.AutotestSceneRequest) error

整组移动

func (*DBClient) MoveAutoTestSceneStepToGroup

func (db *DBClient) MoveAutoTestSceneStepToGroup(req apistructs.AutotestSceneRequest) error

把单个步骤改为目标之后的串行节点

func (*DBClient) MoveSceneSet

func (client *DBClient) MoveSceneSet(req apistructs.SceneSetRequest) error

func (*DBClient) MoveTestPlanV2Step

func (client *DBClient) MoveTestPlanV2Step(req *apistructs.TestPlanV2StepUpdateRequest) error

UpdateTestPlanV2Step Update a step in the test plan

func (*DBClient) OverwriteAutoTestPlanMembers

func (client *DBClient) OverwriteAutoTestPlanMembers(testPlanID uint64, members []AutoTestPlanMember) error

OverwriteAutoTestPlanMembers 使用新的成员列表覆盖之前的成员列表

func (*DBClient) OverwriteAutoTestPlanOwner

func (client *DBClient) OverwriteAutoTestPlanOwner(testPlanID uint64, ownerID string) error

OverwriteAutoTestPlanOwner 使用新的 owner 覆盖之前的 owner

func (*DBClient) OverwriteAutoTestPlanPartners

func (client *DBClient) OverwriteAutoTestPlanPartners(testPlanID uint64, partnerIDs []string) error

OverwriteAutoTestPlanPartners 使用新的 partner 列表覆盖之前的 partner 列表

func (*DBClient) OverwriteTestPlanMembers

func (client *DBClient) OverwriteTestPlanMembers(testPlanID uint64, members []TestPlanMember) error

OverwriteTestPlanMembers 使用新的成员列表覆盖之前的成员列表

func (*DBClient) OverwriteTestPlanOwner

func (client *DBClient) OverwriteTestPlanOwner(testPlanID uint64, ownerID string) error

OverwriteTestPlanOwner 使用新的 owner 覆盖之前的 owner

func (*DBClient) OverwriteTestPlanPartners

func (client *DBClient) OverwriteTestPlanPartners(testPlanID uint64, partnerIDs []string) error

OverwriteTestPlanPartners 使用新的 partner 列表覆盖之前的 partner 列表

func (*DBClient) PagingSonarMetricRules

func (client *DBClient) PagingSonarMetricRules(req apistructs.SonarMetricRulesPagingRequest) (*dbclient.Paging, error)

PagingTestPlan List test plan

func (*DBClient) PagingTestPlan

func (client *DBClient) PagingTestPlan(req apistructs.TestPlanPagingRequest) (uint64, []TestPlan, error)

PagingTestPlan List test plan

func (*DBClient) PagingTestPlanV2

func (client *DBClient) PagingTestPlanV2(req *apistructs.TestPlanV2PagingRequest) (int, []*apistructs.TestPlanV2, []string, error)

PagingTestPlanV2 Page query testplan

func (*DBClient) RecoverTestCasesByTestSetID

func (client *DBClient) RecoverTestCasesByTestSetID(projectID, testSetID uint64) error

RecoverTestCasesByTestSetID 回收站恢复测试集下的测试用例

func (*DBClient) RecoverTestSet

func (db *DBClient) RecoverTestSet(testSetID, targetTestSetID uint64, name string) error

func (*DBClient) RecycleTestSet

func (db *DBClient) RecycleTestSet(testSetID uint64, newParentID *uint64) error

func (*DBClient) RecycledTestCasesByTestSetID

func (client *DBClient) RecycledTestCasesByTestSetID(projectID, testSetID uint64) error

RecycledTestCasesByTestSetID 回收测试集下的测试用例

func (*DBClient) SceneSetsBySpaceID

func (client *DBClient) SceneSetsBySpaceID(spaceID uint64) ([]SceneSet, error)

Get Scenesets by spaceID

func (*DBClient) Transaction

func (db *DBClient) Transaction(f func(tx *gorm.DB) error) error

Transaction Execute Transaction

func (*DBClient) UpdateAutoTestFileTreeNodeBasicInfo

func (db *DBClient) UpdateAutoTestFileTreeNodeBasicInfo(inode string, updateColumns map[string]interface{}) error

func (*DBClient) UpdateAutoTestPlanMember

func (client *DBClient) UpdateAutoTestPlanMember(mem *AutoTestPlanMember) error

func (*DBClient) UpdateAutoTestSpace

func (db *DBClient) UpdateAutoTestSpace(space *AutoTestSpace) (*AutoTestSpace, error)

UpdateAutoTestSpace 更新测试空间

func (*DBClient) UpdateAutotestScene

func (db *DBClient) UpdateAutotestScene(node *AutoTestScene) error

func (*DBClient) UpdateAutotestSceneInput

func (db *DBClient) UpdateAutotestSceneInput(input *AutoTestSceneInput) error

func (*DBClient) UpdateAutotestSceneOutput

func (db *DBClient) UpdateAutotestSceneOutput(output *AutoTestSceneOutput) error

func (*DBClient) UpdateAutotestSceneStep

func (db *DBClient) UpdateAutotestSceneStep(step *AutoTestSceneStep) error

func (*DBClient) UpdateAutotestSceneUpdateAt

func (db *DBClient) UpdateAutotestSceneUpdateAt(sceneID uint64, time time.Time) error

func (*DBClient) UpdateAutotestSceneUpdater

func (db *DBClient) UpdateAutotestSceneUpdater(sceneID uint64, userID string) error

func (*DBClient) UpdateSceneRefSetID

func (db *DBClient) UpdateSceneRefSetID(copyRefs apistructs.AutoTestSceneCopyRef) error

func (*DBClient) UpdateSceneSet

func (client *DBClient) UpdateSceneSet(sceneSet *SceneSet) (*SceneSet, error)

Update Sceneset

func (*DBClient) UpdateSonarMetricRules

func (client *DBClient) UpdateSonarMetricRules(updateObj *QASonarMetricRules) (err error)

func (*DBClient) UpdateTestCase

func (client *DBClient) UpdateTestCase(uc *TestCase) error

UpdateTestCase 更新测试用例

func (*DBClient) UpdateTestPlan

func (client *DBClient) UpdateTestPlan(testPlan *TestPlan) error

UpdateTestPlan Update test plan

func (*DBClient) UpdateTestPlanMember

func (client *DBClient) UpdateTestPlanMember(mem *TestPlanMember) error

func (*DBClient) UpdateTestPlanTestCaseRel

func (client *DBClient) UpdateTestPlanTestCaseRel(testPlanCaseRel *TestPlanCaseRel) error

UpdateTestPlanTestCaseRel Update testPlanCaseRel

func (*DBClient) UpdateTestPlanV2

func (client *DBClient) UpdateTestPlanV2(testPlanID uint64, fields map[string]interface{}) error

UpdateTestPlanV2 Update test plan

func (*DBClient) UpdateTestPlanV2Step

func (client *DBClient) UpdateTestPlanV2Step(step TestPlanV2Step) error

func (*DBClient) UpdateTestSet

func (db *DBClient) UpdateTestSet(testset *TestSet) error

UpdateTestSet update testset

type GetNum

type GetNum struct {
	ID      uint64 `gorm:"primary_key"`
	SceneID uint64 `gorm:"scene_id"` // 场景ID
}

type IssueTestCaseRelation

type IssueTestCaseRelation struct {
	dbengine.BaseModel
	IssueID           uint64 `json:"issueID"`
	TestPlanID        uint64 `json:"testPlanID"`
	TestPlanCaseRelID uint64 `json:"testPlanCaseRelID"`
	TestCaseID        uint64 `json:"testCaseID"`
	CreatorID         string `json:"creatorID"`
}

IssueTestCaseRelation 事件与用例关联

func (IssueTestCaseRelation) TableName

func (IssueTestCaseRelation) TableName() string

TableName 表名

type PartnerIDs

type PartnerIDs []string

func (*PartnerIDs) Scan

func (ids *PartnerIDs) Scan(value interface{}) error

func (PartnerIDs) Value

func (ids PartnerIDs) Value() (driver.Value, error)

type QASonarMetricRules

type QASonarMetricRules struct {
	ID        int64     `gorm:"primary_key" json:"id"`
	CreatedAt time.Time `gorm:"created_at" json:"createdAt"`
	UpdatedAt time.Time `gorm:"updated_at" json:"updatedAt"`

	Description string `gorm:"description" json:"description"`
	ScopeType   string `gorm:"scope_type" json:"scopeType"`
	ScopeID     string `gorm:"scope_id" json:"scopeId"`
	MetricKeyID int64  `gorm:"metric_key_id" json:"metricKeyId"`
	MetricValue string `gorm:"metric_value" json:"metricValue"`
}

func (QASonarMetricRules) TableName

func (QASonarMetricRules) TableName() string

TableName QASonar对应的数据库表qa_sonar

func (*QASonarMetricRules) ToApi

type SceneSet

type SceneSet struct {
	dbengine.BaseModel
	Name        string
	Description string
	SpaceID     uint64
	PreID       uint64
	CreatorID   string
	UpdaterID   string
}

func (SceneSet) TableName

func (SceneSet) TableName() string

Test TableName

type TestCase

type TestCase struct {
	dbengine.BaseModel
	Name           string
	ProjectID      uint64
	TestSetID      uint64
	Priority       apistructs.TestCasePriority
	PreCondition   string
	StepAndResults TestCaseStepAndResults
	Desc           string
	Recycled       *bool
	From           apistructs.TestCaseFrom
	CreatorID      string
	UpdaterID      string
}

TestCase 测试用例

func (TestCase) TableName

func (TestCase) TableName() string

TableName 设置模型对应数据库表名称

type TestCaseStepAndResults

type TestCaseStepAndResults []apistructs.TestCaseStepAndResult

func (*TestCaseStepAndResults) Scan

func (sr *TestCaseStepAndResults) Scan(value interface{}) error

func (TestCaseStepAndResults) Value

func (sr TestCaseStepAndResults) Value() (driver.Value, error)

type TestPlan

type TestPlan struct {
	dbengine.BaseModel
	Name      string
	Status    apistructs.TPStatus // DOING/PAUSE/DONE
	ProjectID uint64
	CreatorID string
	UpdaterID string
	Summary   string
	StartedAt *time.Time
	EndedAt   *time.Time
	Type      apistructs.TestPlanType
	Inode     string
}

TestPlan 测试计划

func (TestPlan) TableName

func (TestPlan) TableName() string

TableName 表名

type TestPlanCaseRel

type TestPlanCaseRel struct {
	dbengine.BaseModel
	TestPlanID uint64
	TestSetID  uint64
	TestCaseID uint64
	ExecStatus apistructs.TestCaseExecStatus
	CreatorID  string
	UpdaterID  string
	ExecutorID string
}

TestPlanCaseRel

func (TestPlanCaseRel) TableName

func (TestPlanCaseRel) TableName() string

TableName 表名

type TestPlanMember

type TestPlanMember struct {
	dbengine.BaseModel
	TestPlanID uint64                        `json:"testPlanID"`
	Role       apistructs.TestPlanMemberRole `json:"role"`
	UserID     string                        `json:"userID"`
}

TestPlanMember 测试计划成员表

func (TestPlanMember) TableName

func (TestPlanMember) TableName() string

type TestPlanV2

type TestPlanV2 struct {
	dbengine.BaseModel
	Name      string
	Desc      string
	CreatorID string
	UpdaterID string
	ProjectID uint64
	SpaceID   uint64
}

TestPlanV2 测试计划V2

func (*TestPlanV2) Convert2DTO

func (tp *TestPlanV2) Convert2DTO() apistructs.TestPlanV2

Convert2DTO convert DAO to DTO

func (TestPlanV2) TableName

func (TestPlanV2) TableName() string

TableName table name

type TestPlanV2Join

type TestPlanV2Join struct {
	TestPlanV2
	SpaceName string
}

TestPlanV2Join join dice_autotest_space

func (*TestPlanV2Join) Convert2DTO

func (tp *TestPlanV2Join) Convert2DTO() *apistructs.TestPlanV2

Convert2DTO convert DAO to DTO

type TestPlanV2Step

type TestPlanV2Step struct {
	dbengine.BaseModel
	PlanID     uint64
	SceneSetID uint64
	PreID      uint64
}

TestPlanV2Step 测试计划V2步骤

func (TestPlanV2Step) TableName

func (TestPlanV2Step) TableName() string

TableName table name

type TestPlanV2StepJoin

type TestPlanV2StepJoin struct {
	TestPlanV2Step
	SceneSetName string `gorm:"column:name"`
}

TestPlanV2StepJoin 测试计划V2步骤join测试集表

func (TestPlanV2StepJoin) Convert2DTO

func (tps TestPlanV2StepJoin) Convert2DTO() *apistructs.TestPlanV2Step

Convert2DTO Convert to apistructs

type TestSet

type TestSet struct {
	dbengine.BaseModel
	// 测试集的中文名,可重名
	Name string
	// 上一级的所属测试集id,顶级时为0
	ParentID uint64
	// 是否回收
	Recycled bool
	// 项目ID
	ProjectID uint64
	// 路径地址
	Directory string
	// 排序编号
	OrderNum int
	// 创建人ID
	CreatorID string
	// 更新人ID
	UpdaterID string
}

TestSet 测试集

func FakeRootTestSet

func FakeRootTestSet(projectID uint64, recycled bool) TestSet

func (TestSet) TableName

func (TestSet) TableName() string

TableName 数据库表名

Jump to

Keyboard shortcuts

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