dbclient

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PageNo         = "pageNo"
	PageSize       = "pageSize"
	ExtraEndpoint  = "extra_cs_endpoint"
	ExtraAccessKey = "extra_cs_ak"
	ExtraSecretKey = "extra_cs_sk"
	ExtraBucket    = "extra_cs_bucket"

	HTTP = "HTTP"
)

Variables

This section is empty.

Functions

func CreateApiTest

func CreateApiTest(at *ApiTest) (int64, error)

CreateApiTest 创建apiTest信息

func CreateTestEnv

func CreateTestEnv(env *APITestEnv) (int64, error)

CreateTestEnv 创建测试环境变量信息

func DeleteApiTest

func DeleteApiTest(apiID int64) error

DeleteApiTest 删除apiTest信息

func DeleteTestEnv

func DeleteTestEnv(envID int64) error

DeleteTestEnv 删除测试环境变量信息

func InsertTPRecords

func InsertTPRecords(rs ...*TPRecordDO) error

func ListAPIsByTestCaseIDs added in v1.0.0

func ListAPIsByTestCaseIDs(projectID uint64, tcIDs []uint64) (map[uint64][]*ApiTest, error)

func UpdateApiTest

func UpdateApiTest(at *ApiTest) (int64, error)

UpdateApiTest 更新apiTest信息

func UpdateApiTestResults

func UpdateApiTestResults(at *ApiTest) (int64, error)

UpdateApiTestResults 更新apiTest结果信息:status,api_response,assert_result

func UpdateTestEnv

func UpdateTestEnv(env *APITestEnv) error

UpdateTestEnv 更新测试环境变量信息

Types

type APITestEnv

type APITestEnv struct {
	ID        int64     `xorm:"pk autoincr" json:"id"`
	CreatedAt time.Time `xorm:"created" json:"createdAt"`
	UpdatedAt time.Time `xorm:"updated" json:"updatedAt"`

	EnvID   int64  `xorm:"env_id" json:"envID"`
	EnvType string `xorm:"env_type" json:"envType"`
	Name    string `xorm:"name" json:"name"`
	Domain  string `xorm:"domain" json:"domain"`
	Header  string `xorm:"header" json:"header"`
	Global  string `xorm:"global" json:"global"`
}

APITestEnv 存储API测试环境变量

func GetTestEnv

func GetTestEnv(envID int64) (*APITestEnv, error)

GetTestEnv 根据envID获取测试环境变量信息

func GetTestEnvListByEnvID

func GetTestEnvListByEnvID(envID int64, envType string) ([]APITestEnv, error)

GetTestEnvListByEnvID 根据envID获取测试环境变量信息

func (APITestEnv) TableName

func (APITestEnv) TableName() string

TableName APITestEnv对应的数据库表dice_api_test_env

type ApiTest

type ApiTest struct {
	ID        int64     `xorm:"pk autoincr" json:"id"`
	CreatedAt time.Time `xorm:"created" json:"createdAt"`
	UpdatedAt time.Time `xorm:"updated" json:"updatedAt"`

	UsecaseID    int64  `xorm:"usecase_id" json:"usecaseID"`
	UsecaseOrder int64  `xorm:"usecase_order" json:"usecaseOrder"`
	ProjectID    int64  `xorm:"project_id" json:"projectID"`
	PipelineID   int64  `xorm:"pipeline_id" json:"pipelineID"`
	Status       string `xorm:"status" json:"status"`
	ApiInfo      string `xorm:"text" json:"apiInfo"`
	ApiRequest   string `xorm:"longtext" json:"apiRequest"`
	ApiResponse  string `xorm:"longtext" json:"apiResponse"`
	AssertResult string `xorm:"text" json:"assertResult"`
}

ApiTest 存储pmp上接口测试相关的信息,对应数据库表dice_api_test

func GetApiTest

func GetApiTest(apiID int64) (*ApiTest, error)

GetApiTest 根据apiID获取apiTest信息

func GetApiTestListByUsecaseID

func GetApiTestListByUsecaseID(usecaseID int64) ([]ApiTest, error)

GetApiTestListByUsecaseID 根据usecaseID获取apiTest列表

func (ApiTest) TableName

func (ApiTest) TableName() string

TableName DiceApiTest对应的数据库表dice_api_test

type KV

type KV map[string]interface{}

type Paging

type Paging struct {
	Total    int64       `json:"total"`
	PageNo   int         `json:"pageNo"`
	PageSize int         `json:"pageSize"`
	List     interface{} `json:"list"`
}

func FindTPRecordPagingByAppID

func FindTPRecordPagingByAppID(req apistructs.TestRecordPagingRequest) (*Paging, error)

func NewPaging

func NewPaging(pageNo, pageSize int) *Paging

type Pipeline

type Pipeline struct {
	Version string   `json:"version"`
	Stages  []*Stage `json:"stages,omitempty"`

	Envs map[string]string `json:"envs,omitempty"`

	Resources []Resource `json:"resources,omitempty"`

	ResourceTypes []ResourceType `json:"resource_types,omitempty"`

	Triggers []Trigger `json:"triggers,omitempty"`
}

type QASonar

type QASonar struct {
	ID        int64     `xorm:"pk autoincr" json:"id"`
	CreatedAt time.Time `xorm:"created" json:"createdAt"`
	UpdatedAt time.Time `xorm:"updated" json:"updatedAt"`

	ApplicationID    int64  `xorm:"app_id" json:"applicationId"`
	ProjectID        int64  `xorm:"project_id" json:"projectId" validate:"required"`
	BuildID          int64  `xorm:"build_id" json:"buildId"`
	LogID            string `xorm:"log_id" json:"logId"`
	ApplicationName  string `xorm:"app_name" json:"applicationName"`
	OperatorID       string `xorm:"operator_id" json:"operatorId" validate:"required"`
	CommitID         string `xorm:"commit_id" json:"commitId"`
	Branch           string `xorm:"branch" json:"branch" validate:"required"`
	GitRepo          string `xorm:"git_repo" json:"gitRepo" validate:"required"`
	Key              string `xorm:"not null VARCHAR(255)" json:"key,omitempty"`
	Bugs             string `xorm:"longtext" json:"bugs,omitempty"`
	CodeSmells       string `xorm:"longtext" json:"code_smells,omitempty"`
	Vulnerabilities  string `xorm:"longtext" json:"vulnerabilities,omitempty"`
	Coverage         string `xorm:"longtext" json:"coverage,omitempty"`
	Duplications     string `xorm:"longtext" json:"duplications,omitempty"`
	IssuesStatistics string `xorm:"text" json:"issues_statistics,omitempty"`
}

QASonar 存储sonar分析的结果,对应数据库表qa_sonar

func FindLatestSonarByAppID

func FindLatestSonarByAppID(appID int64) (*QASonar, error)

func (QASonar) TableName

func (QASonar) TableName() string

TableName QASonar对应的数据库表qa_sonar

type Resource

type Resource struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Source KV     `json:"source"`
}

type ResourceType

type ResourceType struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Source KV     `json:"source"`
}

type Schedule

type Schedule struct {
	Cron string `json:"cron"`
}

type Stage

type Stage struct {
	Name  string  `json:"name,omitempty"`
	Tasks []Tasks `json:"tasks,omitempty"`
}

type TPRecordDO

type TPRecordDO struct {
	ID        uint64    `xorm:"pk autoincr 'id'" json:"id"`
	CreatedAt time.Time `xorm:"created" json:"createdAt"`
	UpdatedAt time.Time `xorm:"updated" json:"updatedAt"`

	ApplicationID   int64                    `xorm:"app_id" json:"applicationId"`
	ProjectID       int64                    `xorm:"project_id" json:"projectId" validate:"required"`
	BuildID         int64                    `xorm:"build_id" json:"buildId"`
	Name            string                   `xorm:"name" json:"name" validate:"required"`
	UUID            string                   `xorm:"uuid" json:"uuid"`
	ApplicationName string                   `xorm:"app_name" json:"applicationName"`
	Output          string                   `xorm:"output" json:"output"`
	Desc            string                   `xorm:"desc" json:"desc"`
	OperatorID      string                   `xorm:"operator_id" json:"operatorId"`
	OperatorName    string                   `xorm:"operator_name" json:"operatorName"`
	CommitID        string                   `xorm:"commit_id" json:"commitId"`
	Branch          string                   `xorm:"branch" json:"branch" validate:"required"`
	GitRepo         string                   `xorm:"git_repo" json:"gitRepo" validate:"required"`
	CaseDir         string                   `xorm:"case_dir" json:"caseDir"`
	Application     string                   `xorm:"-" json:"application"`
	Avatar          string                   `xorm:"-" json:"avatar,omitempty"`
	TType           apistructs.TestType      `xorm:"type" json:"type" validate:"required"`
	Totals          *apistructs.TestTotals   `xorm:"totals json" json:"totals"`
	ParserType      types.TestParserType     `xorm:"parser_type" json:"parserType"`
	Extra           map[string]string        `xorm:"varchar(1024) 'extra'" json:"extra,omitempty"`
	Envs            map[string]string        `xorm:"varchar(1024) 'envs'" json:"envs"`
	Workspace       apistructs.DiceWorkspace `xorm:"workspace" json:"workspace" validate:"required"`
	Suites          []*apistructs.TestSuite  `xorm:"longtext 'suites'" json:"suites"`
}

func FindTPRecord

func FindTPRecord(tp *TPRecordDO) (*TPRecordDO, error)

func FindTPRecordByCommitId

func FindTPRecordByCommitId(commitID string) (*TPRecordDO, error)

func FindTPRecordById

func FindTPRecordById(id uint64) (*TPRecordDO, error)

func InsertTPRecord

func InsertTPRecord(r *TPRecordDO) (*TPRecordDO, error)

func NewTPRecordDO

func NewTPRecordDO() *TPRecordDO

func (*TPRecordDO) EraseSensitiveInfo

func (tp *TPRecordDO) EraseSensitiveInfo()

func (*TPRecordDO) GenSubject

func (tp *TPRecordDO) GenSubject() string

func (*TPRecordDO) GetExtraInfo

func (tp *TPRecordDO) GetExtraInfo(key string) string

func (*TPRecordDO) GetRecordName

func (tp *TPRecordDO) GetRecordName() string

func (*TPRecordDO) SetCols

func (tp *TPRecordDO) SetCols(cols interface{}) (*TPRecordDO, error)

func (*TPRecordDO) SetTPType

func (tp *TPRecordDO) SetTPType(tpType apistructs.TestType) *TPRecordDO

func (TPRecordDO) TableName

func (TPRecordDO) TableName() string

type Tasks

type Tasks KV

type Trigger

type Trigger struct {
	Schedule Schedule `json:"schedule"`
}

Jump to

Keyboard shortcuts

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