Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"apply.go",
"bfs.go",
"clientmoni.go",
"cluster.go",
"comment.go",
"const.go",
"dto.go",
"grpc.go",
"job.go",
"label.go",
"melloi.go",
"order.go",
"order_admin.go",
"order_report.go",
"ptestjob.go",
"rank.go",
"report_graph.go",
"report_summary.go",
"report_timely.go",
"scene.go",
"script.go",
"script_snap.go",
"tree.go",
"user.go",
"wechat.go",
],
importpath = "go-common/app/admin/ep/melloi/model",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//library/ecode:go_default_library",
"//library/log:go_default_library",
"//library/time:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,36 @@
package model
//Apply apply model
type Apply struct {
ID int64 `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
Path string `json:"path"`
From string `json:"from" form:"from"`
To string `json:"to" form:"to"`
Status int32 `json:"status" form:"status"`
StartTime string `json:"start_time" form:"start_time"`
EndTime string `json:"end_time" form:"end_time"`
Active int32 `json:"active"`
}
//const definition
const (
ApplyValid = 1 // active=1 有效
ApplyInvalid = -1 // active=-1 无效
)
// QueryApplyResponse response model
type QueryApplyResponse struct {
ApplyList []*Apply `json:"apply_list"`
Pagination
}
// QueryApplyRequest request model
type QueryApplyRequest struct {
Apply
Pagination
}
// TableName get table name model
func (w Apply) TableName() string {
return "apply"
}

View File

@@ -0,0 +1,8 @@
package model
// BFSConf service bfs conf model
type BFSConf struct {
Host string
AccessKey string
AccessSecret string
}

View File

@@ -0,0 +1,21 @@
package model
import "time"
//ClientMoni model for performance test container cpu monitor
type ClientMoni struct {
ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
ScriptID int `json:"script_id" form:"script_id"`
ReportSuID int `json:"report_su_id" form:"report_su_id"`
JobName string `json:"job_name" form:"job_name"`
JobNameAll string `json:"job_name_all" form:"job_name_all"`
CPUUsed string `json:"cpu_used" form:"cpu_used"`
ElapsdTime int `json:"elapsd_time"`
Ctime time.Time `json:"ctime" form:"ctime"`
Mtime time.Time `json:"mtime" form:"mtime"`
}
//TableName table name of client moni model
func (c ClientMoni) TableName() string {
return "client_moni"
}

View File

@@ -0,0 +1,118 @@
package model
import (
"net/http"
"go-common/library/ecode"
"go-common/library/log"
)
//ClusterItems cluster items
type ClusterItems struct {
Items map[string]interface{} `json:"items"`
}
//RmTokenPost get token
type RmTokenPost = struct {
APIToken string `json:"api_token"`
PlatformID string `json:"platform_id"`
}
//ClusterResponse json body
type ClusterResponse struct {
ExcludeDataResponse
Count int `json:"count"`
Data *ClusterResponseItems `json:"data"`
}
//ClusterResponseItems json body
type ClusterResponseItems struct {
Items []*ClusterResponseItemsSon `json:"items"`
}
//ClusterResponseItemsSon json body
type ClusterResponseItemsSon struct {
Configuration ClusterConfiguration `json:"configuration"`
Resources ClusterPoolResourcesUsage `json:"resources"`
PoolResourcesUsage PoolResourcesUsageSon `json:"pool_resources_usage"`
}
//PoolResourcesUsageSon json body
type PoolResourcesUsageSon struct {
Ep ClusterPoolResourcesUsage `json:"ep"`
Melloi ClusterPoolResourcesUsage `json:"melloi"`
Public ClusterPoolResourcesUsage `json:"public"`
}
//ClusterConf visit PaaS
type ClusterConf struct {
TestHost string
UatHost string
QueryJobCPUHost string
}
// ClusterRmTokenResponse query token response.
type ClusterRmTokenResponse struct {
ExcludeDataResponse
Data AuthData `json:"data"`
}
// ExcludeDataResponse no data field response.
type ExcludeDataResponse struct {
Status int `json:"status"`
Message string `json:"message"`
}
// CheckStatus check status.
func (e *ExcludeDataResponse) CheckStatus() (err error) {
if e.Status >= http.StatusMultipleChoices || e.Status < http.StatusOK {
log.Error("The status(%d) of paas may represent a request error(%s)", e.Status, e.Message)
err = ecode.MelloiPaasRequestErr
}
return
}
//AuthData AuthData stuct
type AuthData struct {
Token string `json:"token"`
PlatformID string `json:"platform_id"`
UserName string `json:"user_name"`
Secret string `json:"secret"`
Expired int `json:"expired"`
Admin bool `json:"admin"`
}
//ClusterPoolResourcesUsage ClusterPoolResourcesUsage stuct
type ClusterPoolResourcesUsage struct {
CPURequest int `json:"cpu_request"`
CPULimit int `json:"cpu_limit"`
CPUCapacity int `json:"cpu_capacity"`
CPUAllocatable int `json:"cpu_allocatable"`
MemoryRequest int `json:"memory_request"`
MemoryLimit int `json:"memory_limit"`
MemoryCapacity int `json:"memory_capacity"`
MemoryAllocatable int `json:"memory_allocatable"`
PodRunning int `json:"pod_running"`
PodTotal int `json:"pod_total"`
PodCapacity int `json:"pod_capacity"`
PodAllocatable int `json:"pod_allocatable"`
NodesNum int `json:"nodes_num"`
}
//ClusterConfiguration ClusterConfiguration stuct
type ClusterConfiguration struct {
ID int `json:"id"`
Name string `json:"name"`
Desc string `json:"desc"`
Region string `json:"region"`
Zone string `json:"zone"`
Idc string `json:"idc"`
Envs string `json:"envs"`
CloudProvider string `json:"cloud_provider"`
Orchestrator string `json:"orchestrator"`
APITarget string `json:"api_target"`
Register string `json:"register"`
DefaultRegistry string `json:"default_registry"`
Ctime string `json:"ctime"`
Mtime string `json:"mtime"`
}

View File

@@ -0,0 +1,24 @@
package model
import "time"
//Comment model for performance test job comment
type Comment struct {
ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
ReportID int `json:"report_id" form:"report_id"`
Content string `json:"content" gorm:"content"`
UserName string `json:"user_name" form:"user_name" gorm:"user_name"`
Status int `json:"status" form:"status"`
SubmitDate time.Time `json:"submit_date"`
}
//QueryCommentResponse model for QueryCommentResponse
type QueryCommentResponse struct {
Total int `json:"total"`
Comments []*Comment `json:"comment_list"`
}
//TableName db table name of Comment
func (w Comment) TableName() string {
return "comment"
}

View File

@@ -0,0 +1,71 @@
package model
// const const
const (
PROTOCOL_HTTP = 0
PROTOCOL_GRPC = 1
PROTOCOL_SCENE = 2
HTTP_SCRIPT_TYPE = 1
SCENE_SCRIPT_TYPE = 2
//HeaderStart header start
HeaderStart = "<elementProp name=\"\" elementType=\"Header\"><stringProp name=\"Header.name\">"
//HeaderMid header mid
HeaderMid = "</stringProp><stringProp name=\"Header.value\">"
//HeaderEnd header end
HeaderEnd = "</stringProp></elementProp>"
//ElementPropName element propname
ElementPropName = "<elementProp name=\""
//HTTPArgument http arg
HTTPArgument = "\" elementType=\"HTTPArgument\">"
//HTTPArgumentEncode http arg code
HTTPArgumentEncode = "<boolProp name=\"HTTPArgument.always_encode\">false</boolProp>"
//ArgumentStart arg start
ArgumentStart = "<stringProp name=\"Argument.value\">"
//ArgumentMid arg mid
ArgumentMid = "</stringProp><stringProp name=\"Argument.metadata\">=</stringProp><boolProp name=\"HTTPArgument.use_equals\"" +
">true</boolProp><stringProp name=\"Argument.name\">"
//ArgumentEnd arg end
ArgumentEnd = "</stringProp></elementProp>"
//AsyncInfo async info
AsyncInfo = "<boolProp name=\"asyncCall\">true</boolProp>"
//MultipartName Multipart Name
MultipartName = "<elementProp name=\"HTTPsampler.Files\" elementType=\"HTTPFileArgs\"><collectionProp name=\"HTTPFileArgs.files\"><elementProp name=\""
//MultipartFilePath MultipartFile Path
MultipartFilePath = "\" elementType=\"HTTPFileArg\"><stringProp name=\"File.path\">"
//MultipartFilePathd MultipartFile Pathd
MultipartFilePathd = "</stringProp><stringProp name=\"File.paramname\">"
//MultipartMime type
MultipartMimetype = "</stringProp><stringProp name=\"File.mimetype\">"
//Multipart End
MultipartEnd = "</stringProp></elementProp></collectionProp></elementProp>"
//Assertion start
AssertionStart = "<stringProp name=\"927604211\">"
//Assertion End
AssertionEnd = "</stringProp>"
//ConstTimer const timer
ConstTimer = "<ConstantTimer guiclass=\"ConstantTimerGui\" testclass=\"ConstantTimer\" testname=\"固定定时器\" enabled=\"true\">" +
"<stringProp name=\"ConstantTimer.delay\">1000</stringProp>" +
"</ConstantTimer>" +
"<hashTree/>"
//Randomtimer Random Timer
RandomTimer = "<GaussianRandomTimer guiclass=\"GaussianRandomTimerGui\" testclass=\"GaussianRandomTimer\" testname=\"高斯随机定时器\" enabled=\"true\">" +
"<stringProp name=\"ConstantTimer.delay\">1000</stringProp>" +
"<stringProp name=\"RandomTimer.range\">500</stringProp>" +
"</GaussianRandomTimer>" +
"<hashTree/>"
//
)

View File

@@ -0,0 +1,95 @@
package model
import "go-common/library/time"
// GRPC grpc model
type GRPC struct {
ID int `json:"id" form:"id" gorm:"AUTO_INCREMENT;primary_key;"`
TaskName string `json:"task_name" form:"task_name" gorm:"task_name"`
Department string `json:"department" form:"department" gorm:"department"`
Project string `json:"project" form:"project" gorm:"project"`
APP string `json:"app" form:"app" gorm:"app"`
Active int `json:"active" form:"active" gorm:"active"`
HostName string `json:"host_name," form:"host_name" gorm:"host_name"`
Port int `json:"port" form:"port" gorm:"port"`
ServiceName string `json:"service_name" form:"service_name" gorm:"service_name"`
ProtoClassName string `json:"proto_class_name" form:"proto_class_name" gorm:"proto_class_name"`
PkgPath string `json:"pkg_path" form:"pkg_path" gorm:"pkg_path"`
AsynCall int `json:"asyn_call" form:"asyn_call" gorm:"asyn_call"`
RequestType string `json:"request_type" form:"request_type" gorm:"request_type"`
RequestMethod string `json:"request_method" form:"request_method" gorm:"request_method"`
RequestContent string `json:"request_content" form:"request_content" gorm:"request_content"`
ResponseType string `json:"response_type" form:"response_type" gorm:"response_type"`
ScriptPath string `json:"script_path" form:"script_path" gorm:"script_path"`
JarPath string `json:"jar_path" form:"jar_path" gorm:"jar_path"`
JmxPath string `json:"jmx_path" form:"jmx_path" gorm:"jmx_path"`
JmxLog string `json:"jmx_log" form:"jmx_log" gorm:"jmx_log"`
JtlLog string `json:"jtl_log" form:"jtl_log" gorm:"jtl_log"`
ThreadsSum int `json:"threads_sum" form:"threads_sum" gorm:"threads_sum"`
RampUp int `json:"ramp_up" form:"ramp_up" gorm:"ramp_up"`
Loops int `json:"loops" form:"loop" gorm:"loops"`
LoadTime int `json:"load_time" form:"load_time" gorm:"load_time"`
UpdateBy string `json:"update_by" form:"update_by" gorm:"update_by"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
IsDebug int `json:"is_debug" gorm:"-"`
IsAsync bool `json:"is_async" form:"is_async" gorm:"is_async"`
AsyncInfo interface{} `json:"async_info" gorm:"-"`
ParamEnable string `json:"param_enable" `
ParamDelimiter string `json:"param_delimiter"`
ParamFilePath string `json:"param_file_path" gorm:"param_file_path"`
ParamNames string `json:"param_names"`
}
// GRPCSnap grpc snap model
type GRPCSnap struct {
ID int `json:"id" form:"id" gorm:"AUTO_INCREMENT;primary_key;"`
GRPCID int `json:"grpc_id" form:"grpc_id" gorm:"column:grpc_id"`
TaskName string `json:"task_name" form:"task_name" gorm:"task_name"`
Department string `json:"department" form:"department" gorm:"department"`
Project string `json:"project" form:"project" gorm:"project"`
APP string `json:"app" form:"app" gorm:"app"`
Active int `json:"active" form:"active" gorm:"active"`
HostName string `json:"host_name," form:"host_name" gorm:"host_name"`
Port int `json:"port" form:"port" gorm:"port"`
ServiceName string `json:"service_name" form:"service_name" gorm:"service_name"`
ProtoClassName string `json:"proto_class_name" form:"proto_class_name" gorm:"proto_class_name"`
PkgPath string `json:"pkg_path" form:"pkg_path" gorm:"pkg_path"`
AsynCall int `json:"asyn_call" form:"asyn_call" gorm:"asyn_call"`
RequestType string `json:"request_type" form:"request_type" gorm:"request_type"`
RequestMethod string `json:"request_method" form:"request_method" gorm:"request_method"`
RequestContent string `json:"request_content" form:"request_content" gorm:"request_content"`
ResponseType string `json:"response_type" form:"response_type" gorm:"response_type"`
ScriptPath string `json:"script_path" form:"script_path" gorm:"script_path"`
JarPath string `json:"jar_path" form:"jar_path" gorm:"jar_path"`
JmxPath string `json:"jmx_path" form:"jmx_path" gorm:"jmx_path"`
JmxLog string `json:"jmx_log" form:"jmx_log" gorm:"jmx_log"`
JtlLog string `json:"jtl_log" form:"jtl_log" gorm:"jtl_log"`
ThreadsSum int `json:"threads_sum" form:"threads_sum" gorm:"threads_sum"`
RampUp int `json:"ramp_up" form:"ramp_up" gorm:"ramp_up"`
Loops int `json:"loops" form:"loop" gorm:"loops"`
LoadTime int `json:"load_time" form:"load_time" gorm:"load_time"`
UpdateBy string `json:"update_by" form:"update_by" gorm:"update_by"`
ExecuteID string `json:"execute_id" gorm:"execute_id"`
IsAsync bool `json:"is_async" form:"is_async" gorm:"is_async"`
ParamEnable string `json:"param_enable" `
ParamDelimiter string `json:"param_delimiter"`
ParamFilePath string `json:"param_file_path" gorm:"param_file_path"`
ParamNames string `json:"param_names"`
}
// ProtoPathModel create proto dependency path
type ProtoPathModel struct {
RootPath string `json:"root_path"`
ExtraPath string `json:"extra_path"`
}
// DependResponse depend reponse
type DependResponse struct {
Items []Item `json:"items"`
}
// Item serivce name
type Item struct {
ServiceName string `json:"service_name"`
}

View File

@@ -0,0 +1,111 @@
package model
import "go-common/library/time"
// GRPCQuickStartRequest GRPCModel grpc models
type GRPCQuickStartRequest struct {
GRPCAddScriptRequest
}
// GRPCAddScriptRequest GRPC Add Script Request
type GRPCAddScriptRequest struct {
TaskName string `json:"task_name"`
Department string `json:"department"`
Project string `json:"project"`
APP string `json:"app"`
Active int `json:"active"`
HostName string `json:"host_name,"`
Port int `json:"port"`
ServiceName string `json:"service_name"`
ProtoClassName string `json:"proto_class_name"`
PkgPath string `json:"pkg_path"`
AsynCall int `json:"asyn_call"`
RequestType string `json:"request_type"`
RequestMethod string `json:"request_method"`
RequestContent string `json:"request_content"`
ResponseType string `json:"response_type"`
ScriptPath string `json:"script_path"`
JarPath string `json:"jar_path"`
ThreadsSum int `json:"threads_sum"`
RampUp int `json:"ramp_up"`
Loops int `json:"loops"`
LoadTime int `json:"load_time"`
UpdateBy string `json:"update_by"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
IsDebug int `json:"is_debug" gorm:"-"` // 判断是否调试,不落库
IsAsync bool `json:"is_async" form:"is_async"`
AsyncInfo interface{} `json:"async_info" gorm:"-"`
ParamEnable string `json:"param_enable" `
ParamDelimiter string `json:"param_delimiter"`
ParamFilePath string `json:"param_file_path" gorm:"param_file_path"`
ParamNames string `json:"param_names"`
}
// GRPCUpdateScriptRequest GRPC Update Script Request
type GRPCUpdateScriptRequest struct {
ID int `json:"id"`
GRPCAddScriptRequest
}
// GRPCExecuteScriptRequest GRPC Execute Script Request
type GRPCExecuteScriptRequest struct {
ScriptID int `json:"script_id"`
}
// TableName Table Name
func (g GRPC) TableName() string {
return "grpc"
}
// TableName Table Name
func (g GRPCSnap) TableName() string {
return "grpc_snap"
}
// QueryGRPCRequest grpc of query request
type QueryGRPCRequest struct {
Executor string `json:"executor" form:"executor"`
GRPC
Pagination
}
// QueryGRPCResponse grpc of query response
type QueryGRPCResponse struct {
GRPCS []*GRPC `json:"grpcs"`
Pagination
}
// GRPCReqToGRPC GRPC Req To GRPC
func GRPCReqToGRPC(grpcReq *GRPCAddScriptRequest) (grpc *GRPC) {
grpc = &GRPC{}
grpc.TaskName = grpcReq.TaskName
grpc.Department = grpcReq.Department
grpc.Project = grpcReq.Project
grpc.APP = grpcReq.APP
grpc.Active = grpcReq.Active
grpc.HostName = grpcReq.HostName
grpc.Port = grpcReq.Port
grpc.ServiceName = grpcReq.ServiceName
grpc.ProtoClassName = grpcReq.ProtoClassName
grpc.PkgPath = grpcReq.PkgPath
grpc.AsynCall = grpcReq.AsynCall
grpc.RequestType = grpcReq.RequestType
grpc.RequestMethod = grpcReq.RequestMethod
grpc.RequestContent = grpcReq.RequestContent
grpc.ResponseType = grpcReq.ResponseType
grpc.ScriptPath = grpcReq.ScriptPath
grpc.JarPath = grpcReq.JarPath
grpc.ThreadsSum = grpcReq.ThreadsSum
grpc.RampUp = grpcReq.RampUp
grpc.Loops = grpcReq.Loops
grpc.LoadTime = grpcReq.LoadTime
grpc.UpdateBy = grpcReq.UpdateBy
grpc.IsAsync = grpcReq.IsAsync
grpc.AsyncInfo = grpcReq.AsyncInfo
grpc.ParamEnable = grpcReq.ParamEnable
grpc.ParamDelimiter = grpcReq.ParamDelimiter
grpc.ParamFilePath = grpcReq.ParamFilePath
grpc.ParamNames = grpcReq.ParamNames
return
}

View File

@@ -0,0 +1,139 @@
package model
// PaasJobResponse create job response in paas.
type PaasJobResponse struct {
ExcludeDataResponse
Data interface{} `json:"data"`
}
//Job job json
type Job struct {
Name string `json:"name"`
CPU int `json:"cpu"`
Memory int `json:"memory"`
Parallelism int `json:"parallelism"`
FileName string `json:"file_name"`
ResJtl string `json:"res_jtl"`
ResLog string `json:"res_log"`
JmeterLog string `json:"jmeter_log"`
EnvInfo string `json:"env_info"`
JarPath string `json:"jar_path"`
Command string `json:"command"`
}
// CleanableDocker docker clearable container list
type CleanableDocker struct {
Name string `json:"name"`
}
//PaasQueryAndDelJob query and del machines request.
type PaasQueryAndDelJob struct {
BusinessUnit string `json:"business_unit"`
Project string `json:"project"`
App string `json:"app"`
Env string `json:"env"`
Name string `json:"name"`
ClusterID int `json:"cluster_id"`
TreeID int `json:"tree_id"`
}
// PaasJobDetail machine detail.
type PaasJobDetail struct {
BusinessUnit string `json:"business_unit"`
Project string `json:"project"`
App string `json:"app"`
Env string `json:"env"`
Name string `json:"name"`
Image string `json:"image"`
ImageVersion string `json:"image_version"`
Volumes string `json:"volumes"`
CPURequest int `json:"cpu_request"`
CPULimit int `json:"cpu_limit"`
MemoryRequest int `json:"memory_request"`
Command string `json:"command"`
ResourcePoolID string `json:"resource_pool_id"`
Parallelism int `json:"parallelism"`
Completions int `json:"completions"`
RetriesLimit int `json:"retries_limit"`
NetworkID int `json:"network_id"`
ClusterID int `json:"cluster_id"`
TreeID int `json:"tree_id"`
HostInfo string `json:"host_info"`
EnvInfo string `json:"env_info"`
}
// PaasJobQueryStatus machine detail.
type PaasJobQueryStatus struct {
ExcludeDataResponse
Data PaasJobQueryData `json:"data"`
}
// PaasJobQueryData machine detail.
type PaasJobQueryData struct {
StartTime string `json:"start_time"`
CompletionTime string `json:"completion_time"`
ActiveNum int `json:"active_num"`
SucceededNum int `json:"succeeded_num"`
FailedNum int `json:"failed_num"`
Conditions PaasJobQueryConditions `json:"conditions"`
Pods []PodInfo `json:"pods"`
}
//PaasQueryJobCPUPostDetail query job cpu detail
type PaasQueryJobCPUPostDetail struct {
Action string `json:"Action"`
PublicKey string `json:"PublicKey"`
Signature int `json:"Signature"`
DataSource string `json:"DataSource"`
Query string `json:"Query"`
}
//PaasQueryJobCPUResult paas query cpu result
type PaasQueryJobCPUResult struct {
ReqID string `json:"ReqId"`
Action string `json:"Action"`
RetCode int `json:"RetCode"`
Data []CPUResult `json:"Data"`
}
//CPUResult cpu result
type CPUResult struct {
JobMetric JobMetric `json:"metric"`
Value []interface{} `json:"value"`
}
//JobMetric job metric
type JobMetric struct {
ContainerEnvAppID string `json:"container_env_app_id"`
ContainerEnvDeployEnv string `json:"container_env_deploy_env"`
ContainerEnvPodCon string `json:"container_env_pod_container"`
ContainerEnvPodName string `json:"container_env_pod_name"`
Job string `json:"job"`
Pro string `json:"pro"`
}
// PodInfo pod info
type PodInfo struct {
AppID string `json:"app_id"`
AppType string `json:"app_type"`
ContainerID string `json:"container_id"`
ContainerStatuses interface{} `json:"container_statuses"`
CreateTime string `json:"create_time"`
DeployEnv string `json:"deploy_env"`
DiscoveryStatus interface{} `json:"discovery_status"`
Health string `json:"health"`
HostIP string `json:"host_ip"`
Image string `json:"image"`
IP string `json:"ip"`
Lables interface{} `json:"lables"`
Name string `json:"name"`
Namespace string `json:"namespace"`
Port interface{} `json:"port"`
StartTime string `json:"start_time"`
Status string `json:"status"`
}
// PaasJobQueryConditions machine detail.
type PaasJobQueryConditions struct {
Complete string `json:"complete"`
}

View File

@@ -0,0 +1,39 @@
package model
//Label label
type Label struct {
ID int64 `json:"id" form:"id" gorm:"AUTO_INCREMENT;primary_key;"`
Name string `json:"label_name"`
Description string `json:"description"`
Color string `json:"color"`
Active int `json:"active"`
}
//LabelName db table name for label
func (l Label) LabelName() string {
return "label"
}
//LabelRelation label relation
type LabelRelation struct {
ID int64 `json:"id" form:"id" gorm:"AUTO_INCREMENT;primary_key;"`
LabelID int64 `json:"label_id" form:"label_id"`
LabelName string `json:"label_name" form:"label_name"`
Color string `json:"color" form:"color"`
Description string `json:"description" form:"description"`
TargetID int64 `json:"target_id" form:"target_id"`
Type int `json:"type"`
Active int `json:"active"`
}
// LabelRelation type const
const (
DefaultType = iota
ScriptType
ReportType
)
//LabelRelationName db table name of label relation
func (l LabelRelation) LabelRelationName() string {
return "label_relation"
}

View File

@@ -0,0 +1,149 @@
package model
//PaginateScripts page script
type PaginateScripts struct {
Total int `json:"total"`
Pn int `json:"page_num"`
Ps int `json:"page_size"`
Scripts []*Script `json:"scripts"`
}
//PaginateReports page report
type PaginateReports struct {
Total int `json:"total"`
Pn int `json:"page_num"`
Ps int `json:"page_size"`
ReportSummarys []*ReportSummary `json:"reportInfos"`
}
//ReducePtest model for test stress reduce
type ReducePtest struct {
ID int `json:"id" form:"id"`
JobName string `json:"job_name" form:"job_name"`
}
//PtestBatch ptest batch
type PtestBatch struct {
UserName string `json:"user_name"`
IDArr []int `json:"id_arr"`
}
//JobBatch batch job
type JobBatch struct {
JobNames []string `json:"job_names"`
ReportSuIDs []int `json:"report_su_ids" form:"report_su_ids"`
}
//DockerStats model for container status
type DockerStats struct {
Container string `json:"container" form:"container"`
Memory interface{} `json:"memory" form:"memory"`
CPU string `json:"cpu" form:"cpu"`
}
//DoPtestParam ptest param
type DoPtestParam struct {
UserName string `json:"user_name"`
LoadTime int `json:"load_time"`
TestNames []string `json:"test_names"` // 人工上传的脚本,可能会有很多接口名
SceneName string `json:"scene_name"`
TestNameNick string `json:"test_name_nick"`
TestNameNicks []string `json:"test_name_nicks"`
FileName string `json:"file_name"`
Upload bool `json:"upload"`
ProjectName string `json:"project_name"`
ResLog string `json:"res_log"`
ResJtl string `json:"res_jtl"`
JmeterLog string `json:"jmeter_log"`
Department string `json:"department"`
Project string `json:"project"`
APP string `json:"app"`
ScriptID int `json:"script_id"`
AddPtest bool `json:"add_ptest"`
IsDebug bool `json:"is_debug"`
Cookie string `json:"cookie"`
URL string `json:"url"`
Domain string `json:"domain"`
LabelIDs []int `json:"label_ids"`
FileSplit bool `json:"file_split"`
SplitNum int `json:"split_num"`
DockerSum int `json:"docker_sum"`
JarPath string `json:"jar_path"`
EnvInfo string `json:"env_info"`
IsScene bool `json:"is_scene"` //场景压测
Type int `json:"type"` // 0.http单接口 1.场景报告 2.grpc报告 3.全链路
Scripts []*Script `json:"scripts"`
SceneID int `json:"scene_id"`
Fusing int `json:"fusing"`
APIHeader string `json:"api_header"`
ExecuDockerSum int `json:"execu_docker_sum"`
UseBusinessStop bool `json:"use_business_stop"`
BusinessStopPercent int `json:"business_stop_percent"`
}
//QueryReGraphParam query ReGraphParam
type QueryReGraphParam struct {
TestNameNicks []string `json:"test_name_nicks" form:"test_name_nicks"`
}
//UploadParam uplaod param
type UploadParam struct {
Path string `json:"path" form:"path" params:"path"`
IsPtest bool `json:"is_ptest" form:"is_ptest" params:"is_ptest"`
UserName string `json:"user_name" form:"user_name" params:"user_name"`
TestName string `json:"test_name" form:"test_name" params:"test_name"`
Department string `json:"department" form:"department" params:"department"`
Project string `json:"project" form:"project" params:"project"`
APP string `json:"app" form:"app" params:"app"`
ScriptPath string `json:"script_path" form:"script_path" params:"script_path"`
Domains string `json:"domains" form:"domains" params:"domains"`
Fusing int `json:"fusing" form:"fusing"`
UseBusinessStop bool `json:"use_business_stop" form:"use_business_stop"`
BusinessStopPercent int `json:"business_stop_percent" form:"business_stop_percent"`
}
//QueryReportsRequest query report request
type QueryReportsRequest struct {
ID string `params:"id" form:"id" json:"id"`
TestNameNick string `params:"test_name_nick" form:"test_name_nick" json:"test_name_nick"`
TestName string `params:"test_name" form:"test_name" json:"test_name"`
Ps int `params:"page_size" form:"page_size" json:"page_size"`
Pn int `params:"page_num" form:"page_num" json:"page_num"`
}
//BfsUploadParam bfs upload param
type BfsUploadParam struct {
BfsIP string `json:"bfs_ip" form:"bfs_ip" params:"bfs_ip"`
BfsPort int `json:"bfs_port" form:"bfs_port" params:"bfs_port"`
BucketName string `json:"bucket_name" form:"bucket_name" params:"bucket_name"`
FileName string `json:"file_name" form:"file_name" params:"file_name"`
AccessKey string `json:"access_key" form:"access_key" params:"access_key"`
AccessSecret string `json:"access_secret" form:"access_secret" params:"access_secret"`
Method string `json:"method" form:"method" params:"method"`
}
//JSONExtractor JSON Extractor
type JSONExtractor struct {
JSONName string `json:"json_name"`
JSONPath string `json:"json_path"`
}
//ReportGraphAdd Report Graph Add
type ReportGraphAdd struct {
ReportSuID int `json:"report_su_id"`
JobName string `json:"job_name"`
TestName string `json:"test_name"`
BeginTime string `json:"begin_time"`
AfterTime string `json:"after_time"`
TestNameNick string `json:"test_name_nick"`
PodNames []string `json:"pod_names"`
ElapsedTime int `json:"elapsed_time"`
Fusing int `json:"fusing"`
UseBusinessStop bool `json:"use_business_stop"`
BusinessStopPercent int `json:"business_stop_percent"`
}
//AllPtestStop all ptest stop
type AllPtestStop struct {
ReportSuID int `json:"report_su_id" form:"report_su_id"`
}

View File

@@ -0,0 +1,85 @@
package model
import (
"time"
"go-common/library/ecode"
)
// Order perf order model
type Order struct {
ID int64 `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
Name string `json:"name" form:"name"`
Broker string `json:"broker" form:"broker"`
TestBackGround string `json:"test_background" form:"test_background" gorm:"column:test_background"`
Type int32 `json:"type" form:"type" gorm:"type"`
TestType int32 `json:"test_type" form:"test_type" gorm:"test_type"`
TestTarget string `json:"test_target" gorm:"test_target"`
APIList string `json:"api_list" gorm:"api_list"`
APIDoc string `json:"api_doc" gorm:"api_doc"`
LimitUser string `json:"limit_user" gorm:"limit_user"`
LimitIP string `json:"limit_ip" gorm:"limit_ip"`
LimitVisit string `json:"limit_visit" gorm:"limit_visit"`
ServerConf string `json:"server_conf" gorm:"server_conf"`
DependentComponent string `json:"dependent_component" gorm:"dependent_component"`
DependentBusiness string `json:"dependent_business" gorm:"dependent_business"`
TestDataFrom string `json:"test_data_from" gorm:"test_data_from"`
TestHost string `json:"test_host" gorm:"test_host"`
MoniRedis string `json:"moni_redis" gorm:"moni_redis"`
MoniMemcache string `json:"moni_memcache" gorm:"moni_memcache"`
MoniDocker string `json:"moni_docker" gorm:"moni_docker"`
MoniAPI string `json:"moni_api" gorm:"moni_api"`
MoniMysql string `json:"moni_mysql" gorm:"moni_mysql"`
MoniElasticsearch string `json:"moni_elasticsearch" gorm:"moni_elasticsearch"`
MoniOther string `json:"moni_other" gorm:"moni_other"`
TestCycles string `json:"test_cycles" gorm:"moni_cycles"`
ScriptID string `json:"script_id" gorm:"script_id"`
MachineID string `json:"machine_id" gorm:"machine_id"`
Department string `json:"department" form:"department" gorm:"department"`
Project string `json:"project" form:"project" gorm:"project"`
App string `json:"app" form:"app" gorm:"app"`
Status int32 `json:"status" form:"status" gorm:"status"`
UpdateBy string `json:"update_by" form:"update_by" gorm:"update_by"`
Handler string `json:"handler" form:"handler" gorm:"handler"`
ApplyDate time.Time `json:"apply_date" gorm:"apply_date"`
Active int32 `json:"active" gorm:"active"`
}
// QueryOrderRequest queryOrderRequest
type QueryOrderRequest struct {
Order
Pagination
}
// QueryOrderResponse queryOrderResponse
type QueryOrderResponse struct {
Orders []*Order `json:"orders"`
Pagination
}
// Verify verify the value of pageNum and pageSize.
func (p *Pagination) Verify() error {
if p.PageNum < 0 {
return ecode.MeilloiIllegalPageNumErr
} else if p.PageNum == 0 {
p.PageNum = 1
}
if p.PageSize < 0 {
return ecode.MeilloillegalPageSizeErr
} else if p.PageSize == 0 {
p.PageSize = 10
}
return nil
}
// Pagination page num
type Pagination struct {
PageNum int32 `form:"page_num" json:"page_num"`
PageSize int32 `form:"page_size" json:"page_size"`
TotalSize int32 `form:"total_size" json:"total_size"`
}
// TableName get table name model
func (w Order) TableName() string {
return "order"
}

View File

@@ -0,0 +1,12 @@
package model
// OrderAdmin perf administrator model for perf order
type OrderAdmin struct {
ID int64 `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
UserName string `json:"user_name" form:"user_name"`
}
// TableName get table name
func (w OrderAdmin) TableName() string {
return "order_admin"
}

View File

@@ -0,0 +1,16 @@
package model
// OrderReport order(manual) report model
type OrderReport struct {
ID int32 `json:"id"`
OrderID int64 `json:"order_id"`
Name string `json:"name"`
Content string `json:"content"`
UpdateBy string `json:"update_by" column:"update_by"`
Active int32 `json:"active"`
}
// TableName get table name model
func (w OrderReport) TableName() string {
return "order_report"
}

View File

@@ -0,0 +1,93 @@
package model
import "time"
//PtestJob performance test job
type PtestJob struct {
ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
ScriptID int `json:"script_id" form:"script_id"`
ReportSuID int `json:"report_su_id" form:"report_su_id"`
JobName string `json:"job_name" form:"job_name"`
Active int `json:"active" form:"active"`
ExecuteID string `json:"execute_id" form:"execute_id"`
HostIP string `json:"host_ip"`
JobIP string `json:"job_ip"`
JobID string `json:"job_id"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
}
//PtestAdd model for adding performance test job
type PtestAdd struct {
ReportSuID int `json:"report_su_id" form:"report_su_id"`
ScriptID int `json:"script_id" form:"script_id"`
JmeterLog string `json:"jmeter_log" form:"jmeter_log"`
ResJtl string `json:"res_jtl" form:"res_jtl"`
JobName string `json:"job_name" form:"job_name"`
DockerSum int `json:"docker_sum" form:"docker_sum"`
ScriptType int `json:"script_type" form:"script_type"`
ExecuteID string `json:"execute_id" form:"execute_id"`
SceneId int `json:"scene_id" form:"scene_id"`
UserName string `json:"user_name" form:"user_name"`
DockerNum int `json:"docker_num" form:"docker_num"`
SleepTime int `json:"sleep_time" form:"sleep_time"`
}
//AddReGraphTimer model for report graph timer
type AddReGraphTimer struct {
ScriptID int `json:"script_id" form:"script_id"`
ReportSuID int `json:"report_su_id" form:"report_su_id"`
JobName string `json:"job_name" form:"job_name"`
BeginTime string `json:"begin_time" form:"begin_time"`
Token string `json:"token" form:"token"`
TestNames []string `json:"test_names" form:"test_names"`
TestNameNicks []string `json:"test_name_nicks" form:"test_name_nicks"`
Fusing int `json:"fusing"`
FusingList []int `json:"fusing_list"`
TestType int `json:"test_type"`
UseBusinessStop bool `json:"use_business_stop"`
BusinessStopPercent int `json:"business_stop_percent"`
UseBusiStopList []bool `json:"use_busi_stop_list"`
BusiStopPercentList []int `json:"busi_stop_percent_list"`
}
//DoPtestResp doptest response
type DoPtestResp struct {
BeginTime string `json:"begin_time"`
JobName string `json:"job_name"`
ReportSuID int `json:"report_su_id"`
ScriptSnapIDs []int `json:"script_snap_ids"`
ScriptID int `json:"script_id"`
Message string `json:"message"`
ScriptSnapID int `json:"script_snap_id"`
JmeterLog string `json:"jmeter_log"`
JtlLog string `json:"jtl_log"`
JmxFile string `json:"jmx_file"`
GroupID int `json:"group_id"`
RunOrder int `json:"run_order"`
LoadTime int `json:"load_time"`
HostIP string `json:"host_ip"`
SOS string `json:"sos"`
}
//AddScene add scene
type AddScene struct {
SceneID int `json:"scene_id" form:"scene_id"`
UserName string `json:"user_name" form:"user_name"`
}
//TableName tablename
func (r PtestJob) TableName() string {
return "ptest_job"
}
// JobInfo Job Info
type JobInfo struct {
HostIp string `json:"host_ip" form:"host_ip"`
JobName string `json:"job_name" form:"job_name"`
}
// JobInfoList Job Info List
type JobInfoList struct {
JobList []JobInfo `json:"job_list"`
}

View File

@@ -0,0 +1,103 @@
package model
//Rank rank
type Rank struct {
Duration int `json:"duration" form:"duration"`
TimeDegree string `json:"time_degree" form:"time_degree"`
StartTime string `json:"start_time" form:"start_time"`
EndTime string `json:"end_time" form:"end_time"`
SearchAll bool `json:"search_all" form:"search_all"`
}
//Tree node in service tree
type Tree struct {
Department string `json:"department" form:"department"`
Project string `json:"project" form:"project"`
App string `json:"app" form:"app"`
}
//TreeNum model for department, project and app performance test count statistic
type TreeNum struct {
DeptNum int `json:"dept_num" form:"dept_num"`
ProNum int `json:"pro_num" form:"pro_num"`
AppNum int `json:"app_num" form:"app_num"`
}
//TreeList tree list
type TreeList struct {
TreeList []*Tree `json:"tree_list"`
}
//NumList num list
type NumList struct {
NumList TreeNum `json:"num"`
}
//API api
type API struct {
URL string `json:"url" form:"url"`
Count int `json:"count" form:"count"`
}
// GrpcInfo Grpc Info
type GrpcInfo struct {
ServiceName string `json:"service_name" form:"service_name"`
RequestMethod string `json:"request_method" form:"request_method"`
Count int `json:"count" form:"count"`
}
// GrpcRes Grpc Res
type GrpcRes struct {
GrpcList []*GrpcInfo `json:"grpc_list" form:"grpc_list"`
}
// SceneCount Scene Count
type SceneCount struct {
Department string `json:"department" form:"department"`
SceneName string `json:"scene_name" form:"scene_name"`
Count int `json:"count" form:"count"`
}
// SceneRes SceneRes
type SceneRes struct {
SceneList []*SceneCount `json:"scene_list" form:"scene_list"`
}
//Department department
type Department struct {
Department string `json:"department" form:"department"`
Count int `json:"count" form:"count"`
}
//Build performance test count by date
type Build struct {
Date string `json:"date" form:"date"`
Count int `json:"count" form:"count"`
}
//State model for test status
type State struct {
TestStatus int `json:"test_status" form:"test_status"`
Count int `json:"count" form:"count"`
}
//TopAPIRes performance test top apis
type TopAPIRes struct {
//Total int `json:"total"`
APIList []*API `json:"api_list"`
}
//TopDeptRes performance test top departments
type TopDeptRes struct {
DeptList []*Department `json:"dept_list"`
}
//BuildLineRes test line
type BuildLineRes struct {
BuildList []*Build `json:"build_list"`
}
//StateLineRes test state chart
type StateLineRes struct {
StateList []*State `json:"state_list"`
}

View File

@@ -0,0 +1,49 @@
package model
import (
"time"
)
//ReportGraph reportgraph
type ReportGraph struct {
ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
TestName string `json:"test_name" form:"test_name"`
TestNameNick string `json:"test_name_nick" form:"test_name_nick"`
Count int `json:"count"`
QPS int `json:"qps"`
AvgTime int `json:"avg_time"`
Min int `json:"min"`
Max int `json:"max"`
Error int `json:"error"`
FailPercent string `json:"fail_percent"`
NinetyTime int `json:"ninety_time"`
NinetyFiveTime int `json:"ninety_five_time"`
NinetyNineTime int `json:"ninety_nine_time"`
NetIo int `json:"net_io"`
CodeEll int `json:"code_ell"`
CodeWll int `json:"code_wll"`
CodeWly int `json:"code_wly"`
CodeWle int `json:"code_wle"`
CodeWls int `json:"code_wls"`
CodeSll int `json:"code_sll"`
CodeSly int `json:"code_sly"`
CodeSls int `json:"code_sls"`
CodeKong int `json:"code_kong"`
CodeNonHTTP int `json:"code_non_http"`
CodeOthers int `json:"code_others"`
ElapsdTime int `json:"elapsd_time"`
PodName string `json:"pod_name" form:"pod_name"`
ThreadsSum int `json:"threads_sum"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
FiftyTime int `json:"fifty_time"`
Code301 int `json:"code301"`
Code302 int `json:"code302"`
BeginTime time.Time `json:"begin_time" gorm:"-"`
QpsRecent int `json:"qps_recent" gorm:"-"`
}
//TableName table name
func (r ReportGraph) TableName() string {
return "report_graph"
}

View File

@@ -0,0 +1,77 @@
package model
import (
"time"
)
//ReportSummary report summary
type ReportSummary struct {
ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
ScriptID int `json:"script_id" form:"script_id"`
ScriptSnapID int `json:"script_snap_id" form:"script_snap_id"`
ExecuteID string `json:"execute_id" form:"execute_id"`
Department string `json:"department" form:"department"`
Project string `json:"project" form:"project"`
APP string `json:"app" form:"app"`
TestName string `json:"test_name" form:"test_name" param:"test_name"`
TestNameNick string `json:"test_name_nick" form:"test_name_nick"`
JobName string `json:"job_name" form:"job_name"`
Count int `json:"count"`
QPS int `json:"qps"`
AvgTime int `json:"avg_time"`
Min int `json:"min"`
Max int `json:"max"`
Error int `json:"error"`
FailPercent string `json:"fail_percent"`
NinetyTime int `json:"ninety_time"`
NinetyFiveTime int `json:"ninety_five_time"`
NinetyNineTime int `json:"ninety_nine_time"`
NetIo int `json:"net_io"`
ElapsdTime int `json:"elapsd_time"`
TestStatus int `json:"test_status"`
UserName string `json:"user_name" form:"user_name"`
ResJtl string `json:"res_jtl"`
JmeterLog string `json:"jmeter_log"`
DockerSum int `json:"docker_sum"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
Debug int `json:"debug"`
Active int `json:"active" form:"active"`
SceneID int `json:"scene_id" form:"scene_id"`
Type int `json:"type" form:"type"` // 0.http单接口 1.grpc报告 2.场景报告 3.全链路
LoadTime int `json:"load_time"` //执行时间
FiftyTime int `json:"fifty_time"`
IsFusing bool `json:"is_fusing"` //是否熔断
FusingTestName string `json:"fusing_test_name"` //被熔断接口
SuccessCodeRate int `json:"success_code_rate"` //熔断时接口的httpcode
SuccessBusinessRate int `json:"success_business_rate"` //熔断时接口的成功率
FusingValue int `json:"fusing_value"` //熔断阈值
BusinessValue int `json:"business_value"` //业务熔断阈值
UseBusinessStop bool `json:"use_business_stop"` //是否使用业务熔断
}
//QueryReportSuRequest query report summary request
type QueryReportSuRequest struct {
ReportSummary
//Script
Pagination
Executor string `json:"executor" form:"executor"`
SearchAll bool `json:"search_all" form:"search_all"`
}
//QueryReportSuResponse query report summary response
type QueryReportSuResponse struct {
ReportSummarys []*ReportLabels `json:"reports"`
Pagination
}
//ReportLabels report labels
type ReportLabels struct {
ReportSummary
Labels []*LabelRelation `json:"labels"`
}
//TableName tablename
func (r ReportSummary) TableName() string {
return "report_summary"
}

View File

@@ -0,0 +1,43 @@
package model
import "time"
//ReportTimely report timely
type ReportTimely struct {
ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
TestName string `json:"test_name" form:"test_name"`
Count int `json:"count"`
QPS int `json:"qps"`
AvgTime int `json:"avg_time"`
Min int `json:"min"`
Max int `json:"max"`
Error int `json:"error"`
FailPercent string `json:"fail_percent"`
NinetyTime int `json:"ninety_time"`
NinetyFiveTime int `json:"ninety_five_time"`
NinetyNineTime int `json:"ninety_nine_time"`
NetIo int `json:"net_io"`
CodeEll int `json:"code_ell"`
CodeWll int `json:"code_wll"`
CodeWly int `json:"code_wly"`
CodeWle int `json:"code_wle"`
CodeWls int `json:"code_wls"`
CodeSll int `json:"code_sll"`
CodeSly int `json:"code_sly"`
CodeSls int `json:"code_sls"`
CodeKong int `json:"code_kong"`
CodeNonHTTP int `json:"code_non_http"`
CodeOthers int `json:"code_others"`
PodName string `json:"pod_name" form:"pod_name"`
ThreadsSum int `json:"threads_sum"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
FiftyTime int `json:"fifty_time"`
Code301 int `json:"code301"`
Code302 int `json:"code302"`
}
//TableName table name
func (r ReportTimely) TableName() string {
return "report_timely"
}

View File

@@ -0,0 +1,266 @@
package model
import (
"time"
)
// Scene GRPCReqToGRPC
type Scene struct {
ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
SceneName string `json:"scene_name" form:"scene_name"`
SceneType int `json:"scene_type" form:"scene_type"`
UserName string `json:"user_name" form:"user_name"`
IsDraft int `json:"is_draft" form:"is_draft"`
IsDebug bool `json:"is_debug" form:"is_debug"`
IsBatch bool `json:"is_batch" gorm:"-"`
Scripts []*Script `json:"scripts" gorm:"-"`
ThreadGroup interface{} `json:"thread_group" gorm:"-"`
ScriptPath string `json:"script_path" gorm:"-"`
IsExecute bool `json:"is_execute" gorm:"-"`
JmeterFilePath string `json:"jmeter_file_path"`
Department string `json:"department" form:"department"`
Project string `json:"project" form:"project"`
APP string `json:"app" form:"app"`
Fusing int `json:"fusing" form:"fusing"`
IsUpdate bool `json:"is_update" form:"is_update" gorm:"-"`
JmeterLog string `json:"jmeter_log"`
ResJtl string `json:"res_jtl"`
IsActive bool `json:"is_active" form:"is_active"`
Ctime time.Time `json:"ctime" form:"ctime"`
Mtime time.Time `json:"mtime" form:"mtime"`
}
// Draft Draft
type Draft struct {
SceneID int `json:"scene_id" form:"scene_id"`
SceneName string `json:"scene_name" form:"scene_name"`
}
// QueryDraft QueryDraft
type QueryDraft struct {
Total int `json:"total"`
Drafts []*Draft `json:"draft_list"`
}
// Relation Relation
type Relation struct {
GroupID int `json:"group_id"`
Count int `json:"count"`
}
// QueryRelation Query Relation
type QueryRelation struct {
RelationList []*Relation `json:"relation_list"`
}
// QueryAPIs Query APIs
type QueryAPIs struct {
Total int `json:"total"`
SceneID int `json:"scene_id"`
SceneName string `json:"scene_name"`
SceneType int `json:"scene_type"`
Department string `json:"department"`
Project string `json:"project"`
App string `json:"app"`
APIs []*TestAPI `json:"api_list"`
}
// TestAPI Test API
type TestAPI struct {
GroupID int `json:"group_id" form:"group_id"`
RunOrder int `json:"run_order" form:"run_order"`
ID int `json:"id" form:"id"`
TestName string `json:"test_name" form:"test_name"`
URL string `json:"url" form:"url"`
OutputParams string `json:"output_params" form:"output_params"`
ThreadsSum string `json:"threads_sum" form:"threads_sum"`
LoadTime string `json:"load_time" form:"load_time"`
}
// ShowTree Show Tree
type ShowTree struct {
IsShow int `json:"is_show" form:"is_show"`
Tree []*Tree `json:"tree" form:"tree"`
}
// RunOrder Run Order
type RunOrder struct {
SceneID int `json:"scene_id" form:"scene_id"`
SceneType int `json:"scene_type" form:"scene_type"`
}
// RunOrderList Run Order List
type RunOrderList struct {
Total int `json:"total"`
RunOrders []*RunOrder `json:"run_order_list"`
}
// Params Params
type Params struct {
ID int `json:"id" form:"id"`
GroupID int `json:"group_id" form:"group_id"`
RunOrder int `json:"run_order" form:"run_order"`
OutputParams string `json:"output_params" form:"output_params"`
}
// ParamList ParamList
type ParamList struct {
ParamList []*Params `json:"param_list" form:"param_list"`
}
// SaveOrderReq Save Order Req
type SaveOrderReq struct {
GroupOrderList []*GroupOrder `json:"group_order_list"`
}
// GroupOrder Group Order
type GroupOrder struct {
ID int `json:"id"`
TestName string `json:"test_name"`
GroupID int `json:"group_id"`
RunOrder int `json:"run_order"`
}
// TableName Table Name
func (w Scene) TableName() string {
return "scene"
}
//QuerySceneResponse query scene response
type QuerySceneResponse struct {
Scenes []*Scene `json:"scenes"`
Pagination
}
//QuerySceneRequest query script request
type QuerySceneRequest struct {
Scene
Pagination
Executor string `json:"executor" form:"executor"`
}
// DoPtestSceneParam Do Ptest Scene Param
type DoPtestSceneParam struct {
SceneID int `json:"scene_id" form:"scene_id"`
UserName string `json:"user_name" form:"user_name"`
}
// DoPtestSceneParams Do Ptests Scene Param
type DoPtestSceneParams struct {
SceneIDs []int `json:"scene_ids" form:"scene_ids"`
UserName string `json:"user_name" form:"user_name"`
}
// SceneInfo Scene Info
type SceneInfo struct {
MaxLoadTime int `json:"max_load_time" form:"max_load_time"`
TestNames []string `json:"test_names"`
TestNameNicks []string `json:"test_name_nicks"`
JmeterLog string `json:"jmeter_log"`
ResJtl string `json:"res_jtl"`
LoadTimes []int `json:"load_times"`
SceneName string `json:"scene_name"`
Scripts []*Script `json:"scripts"`
}
// APIInfo API Info
type APIInfo struct {
ID int `json:"id" form:"id"`
TestName string `json:"test_name" form:"test_name"`
URL string `json:"url" form:"url"`
ThreadsSum int `json:"threads_sum" form:"threads_sum"`
LoadTime int `json:"load_time" form:"load_time"`
}
// APIInfoList API Info List
type APIInfoList struct {
SceneID int `json:"scene_id" form:"scene_id"`
Pagination
ScriptList []*Script `json:"script_list"`
}
// APIInfoRequest API Info Request
type APIInfoRequest struct {
Script
Pagination
//DeliverySceneID int `json:"delivery_scene_id" form:"delivery_scene_id"`
}
// PreviewInfoList Preview Info List
type PreviewInfoList struct {
PreviewInfoList []*PreviewInfo `json:"preview_info_list"`
}
// PreviewInfo Preview Info
type PreviewInfo struct {
GroupInfo
InfoList []*Preview `json:"info_list"`
}
// Preview Preview
type Preview struct {
ID int `json:"id"`
TestName string `json:"test_name"`
RunOrder int `json:"run_order"`
GroupID int `json:"group_id"`
ConstTimer int `json:"const_timer"`
RandomTimer int `json:"random_timer"`
}
// PreviewList Preview List
type PreviewList struct {
PreList []*Preview `json:"pre_list"`
}
// GroupList Group List
type GroupList struct {
GroupList []*GroupInfo `json:"group_list"`
}
// GroupInfo Group Info
type GroupInfo struct {
GroupID int `json:"group_id"`
ThreadsSum int `json:"threads_sum"`
LoadTime int `json:"load_time"`
ReadyTime int `json:"ready_time"`
}
// UsefulParams Useful Params
type UsefulParams struct {
OutputParams string `json:"output_params"`
}
// UsefulParamsList Useful Params
type UsefulParamsList struct {
ParamsList []*UsefulParams `json:"params_list"`
}
// Test test
type Test struct {
Count int `json:"count"`
}
// BindScene Bind Scene
type BindScene struct {
SceneID int `json:"scene_id"`
ID string `json:"id"`
}
// DrawRelationList Draw Relation List
type DrawRelationList struct {
//Nodes []*string `json:"nodes"`
Nodes []*Node `json:"nodes"`
Edges []*Edge `json:"edges"`
}
// Node Node
type Node struct {
ID int `json:"id"`
Name string `json:"name"`
}
// Edge Edge
type Edge struct {
Source string `json:"source"`
Target string `json:"target"`
}

View File

@@ -0,0 +1,159 @@
package model
import (
"time"
)
//Script script
type Script struct {
ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
TreeID int `json:"tree_id"`
ProjectID int `json:"project_id" form:"project_id"`
Type int `json:"type" form:"type"`
ProjectName string `json:"project_name" form:"project_name"`
TestName string `json:"test_name" form:"test_name"`
ThreadsSum int `json:"threads_sum" form:"threads_sum"`
LoadTime int `json:"load_time"`
ReadyTime int `json:"ready_time"`
ProcType string `json:"proc_type"`
URL string `json:"url" form:"url" gorm:"url"`
Domain string `json:"domain" form:"domain"`
Port string `json:"port"`
Login bool `json:"login"`
Path string `json:"path"`
Method string `json:"method" form:"method"`
Cookie string `json:"cookie" form:"cookie"`
ContentType string `json:"content_type"`
Data string `json:"data" form:"data"`
Assertion string `json:"assertion"`
AssertionString interface{} `json:"assertion_string" gorm:"-"`
UseAssertion bool `json:"use_assertion" gorm:"-"`
UseBuiltinParam bool `json:"use_builtin_param" gorm:"-"`
SavePath string `json:"save_path" form:"save_path"`
ResJtl string `json:"res_jtl" form:"res_jtl"`
JmeterLog string `json:"jmeter_log"`
UpdateBy string `json:"update_by" form:"update_by"`
Ctime time.Time `json:"ctime" form:"ctime"`
Mtime time.Time `json:"mtime" form:"mtime"`
Active int `json:"active"`
Upload bool `json:"upload" form:"upload"`
Headers []map[string]string `json:"headers" form:"headers" gorm:"-"` // true
APIHeader string `json:"api_header"`
ArgumentsMap []map[string]string `json:"arguments_map" gorm:"-"` // true
ArgumentString string `gorm:"column:argument_map"`
RowQuery string `json:"row_query" form:"row_query" gorm:"-"`
UseSign bool `json:"use_sign" form:"use_sign"`
LabelIds []int `json:"label_ids" form:"label_ids" gorm:"-"`
IsCopy bool `json:"is_copy" form:"is_copy" gorm:"-"`
ConnTimeOut int `json:"conn_time_out"`
RespTimeOut int `json:"resp_time_out"`
IsSave bool `json:"is_save" gorm:"-"`
TestType int `json:"test_type" form:"test_type"`
SceneID int `json:"scene_id" form:"scene_id"`
OutputParamsMap []map[string]string `json:"output_params_map" form:"output_params_map" gorm:"-"`
OutputParams string `json:"output_params" form:"output_params"`
JSONPath string `json:"json_path"`
GroupID int `json:"group_id" form:"group_id"`
RunOrder int `json:"run_order" form:"run_order"`
ScriptPath string `json:"script_path" form:"script_path"`
JmeterSample interface{} `json:"jmeter_sample" gorm:"-"`
JSONExtractor interface{} `json:"json_extractor" gorm:"-"`
IsAsync bool `json:"is_async" form:"is_async"`
AsyncInfo interface{} `json:"async_info" gorm:"-"`
MultiPartInfo interface{} `json:"multi_part_info" gorm:"-"`
UseMultipart bool `json:"use_multipart" gorm:"-"`
MultipartPath string `json:"multipart_path"`
MultipartFile string `json:"multipart_file"`
MultipartParam string `json:"multipart_param"`
MimeType string `json:"mime_type"`
Fusing int `json:"fusing"`
UseBusinessStop bool `json:"use_business_stop" form:"use_business_stop"`
BusinessStopPercent int `json:"business_stop_percent" form:"business_stop_percent"`
KeepAlive bool `json:"keep_alive" form:"keep_alive"`
ExecuDockerSum int `json:"execu_docker_sum" gorm:"-"`
ConstTimer int `json:"const_timer"`
ConstTimerInfo interface{} `json:"const_timer_info" gorm:"-"`
RandomTimer int `json:"random_timer"`
RandomTimerInfo interface{} `json:"random_timer_info" gorm:"-"`
DataFile
TreePath
}
//APIH api headers
type APIH struct {
APIHeader []map[string]string `json:"api_header"`
}
//ScriptScene script scene
type ScriptScene struct {
Scripts []Script `json:"scripts" form:"scripts"`
}
// TreePath service tree
type TreePath struct {
Department string `json:"department" form:"department"`
Project string `json:"project" form:"project"`
App string `json:"app" form:"app"`
}
//QueryScriptResponse query script response
type QueryScriptResponse struct {
Scripts []*ScriptLabels `json:"scripts"`
Pagination
}
//ScriptLabels script labels
type ScriptLabels struct {
Script
Labels []*LabelRelation `json:"labels"`
}
//DataFile ignore db
type DataFile struct {
UseDataFile bool `json:"use_data_file" gorm:"use_data_file"` // true
FileName string `json:"file_name" gorm:"file_name"` // true
ParamsName string `json:"params_name" gorm:"params_name"` // true
Delimiter string `json:"delimiter" gorm:"delimiter"` // true
Loops int `json:"loops" gorm:"loops"` // true
ResLog string `json:"res_log" gorm:"-"`
BeginTestName string `json:"begin_test_name" gorm:"-"`
IsDebug bool `json:"is_debug" gorm:"-"`
HeaderString interface{} `json:"header_string" gorm:"-"`
Arguments interface{} `json:"arguments" gorm:"-"`
FileSplit bool `json:"file_split" form:"file_split"`
SplitNum int `json:"split_num" form:"split_num"`
}
//QueryScriptRequest query script request
type QueryScriptRequest struct {
Script
Pagination
Executor string `json:"executor" form:"executor"`
}
//ScrThreadGroup script thread group
type ScrThreadGroup struct {
Scripts []*Script `json:"scripts"`
}
//URLEncode URL Encode
type URLEncode struct {
ParamsType string `json:"params_type"`
NewUrl string `json:"new_url"`
}
//TableName db table name of script
func (st Script) TableName() string {
return "script"
}
// FusingInfo Fusing List
type FusingInfo struct {
Fusing int `json:"fusing"`
}
// FusingInfoList Fusing Info List
type FusingInfoList struct {
FusingList []FusingInfo `json:"fusing_list"`
SetNull bool `json:"set_null"`
}

View File

@@ -0,0 +1,62 @@
package model
import (
"time"
)
//ScriptSnap script snap
type ScriptSnap struct {
ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
ScriptID int `json:"script_id"`
TreeID int `json:"tree_id"`
ProjectID int `json:"project_id" form:"project_id"`
ExecuteID string `json:"execute_id" form:"execute_id"`
Type int `json:"type" form:"type"`
ProjectName string `json:"project_name" form:"project_name"`
TestName string `json:"test_name" form:"test_name"`
ThreadsSum int `json:"threads_sum" form:"threads_sum"`
LoadTime int `json:"load_time"`
ReadyTime int `json:"ready_time"`
ProcType string `json:"proc_type"`
URL string `json:"url"`
Domain string `json:"domain" form:"domain"`
Port string `json:"port"`
Login bool `json:"login"`
Path string `json:"path"`
Method string `json:"method" form:"method"`
Cookie string `json:"cookie" form:"cookie"`
ContentType string `json:"content_type"`
Data string `json:"data" form:"data"`
Assertion string `json:"assertion"`
SavePath string `json:"save_path" form:"save_path"`
ResJtl string `json:"res_jtl" form:"res_jtl"`
JmeterLog string `json:"jmeter_log"`
UpdateBy string `json:"update_by" form:"update_by"`
Ctime time.Time `json:"ctime" form:"ctime"`
Mtime time.Time `json:"mtime" form:"mtime"`
Active int `json:"active"`
Upload bool `json:"upload" form:"upload"`
Headers []map[string]string `json:"headers" form:"headers" gorm:"-"` // true
APIHeader string `json:"api_header" gorm:"column:api_header"`
ArgumentsMap []map[string]string `json:"arguments_map" gorm:"-"` // true
ArgumentString string `gorm:"column:argument_map"`
ConnTimeOut int `json:"conn_time_out"`
RespTimeOut int `json:"resp_time_out"`
UseSign bool `json:"use_sign" form:"use_sign"`
SceneID int `json:"scene_id" form:"scene_id"`
GroupID int `json:"group_id" form:"group_id"`
IsAsync bool `json:"is_async" form:"is_async"`
MultipartPath string `json:"multipart_path"`
MultipartFile string `json:"multipart_file"`
MultipartParam string `json:"multipart_param"`
MimeType string `json:"mime_type"`
Fusing int `json:"fusing"`
KeepAlive bool `json:"keep_alive" form:"keep_alive"`
DataFile
TreePath
}
//TableName script
func (st ScriptSnap) TableName() string {
return "script_snap"
}

View File

@@ -0,0 +1,59 @@
package model
// TreeResponse service tree response model
type TreeResponse struct {
Code int `json:"code"`
Data UserTree `json:"data"`
}
// UserTree user tree model
type UserTree struct {
Bilibili map[string]interface{} `json:"bilibili"`
}
// TreeSonResponse tree son response model
type TreeSonResponse struct {
Code int `json:"code"`
Data map[string]interface{} `json:"data"`
}
// TreeConf service tree conf model
type TreeConf struct {
Host string
}
// TokenResponse service tree token response model
type TokenResponse struct {
Token string `json:"token"`
UserName string `json:"user_name"`
Secret string `json:"secret"`
Expired int64 `json:"expired"`
}
// TreeAdminResponse service tree admin response model
type TreeAdminResponse struct {
Code int `json:"code"`
Data []*TreeRole `json:"data"`
}
// TreeRole service tree role
type TreeRole struct {
UserName string `json:"user_name"`
Role int `json:"role"`
OldRole int `json:"old_role"`
}
// TreeRoleApp tree role app
type TreeRoleApp struct {
Code int `json:"code"`
Data []*RoleApp `json:"data"`
}
// RoleApp role app
type RoleApp struct {
ID int `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Type int `json:"type"` // Type 1.公司 2.部门 3.项目 4. 应用 5.环境 6.挂载点
Role int `json:"role"` // Role 1:管理员 2:研发 3:测试 4:运维 5:访客
}

View File

@@ -0,0 +1,15 @@
package model
// User user model for login
type User struct {
ID int64 `json:"id" gorm:"AUTO_INCREMENT;primary_key;"`
Name string `json:"name"`
Email string `json:"email"`
Accept int32 `json:"accept"`
Active string `json:"active"`
}
// TableName get user model name
func (u User) TableName() string {
return "user"
}

View File

@@ -0,0 +1,34 @@
package model
//MsgSendReq message send request of wechat
type MsgSendReq struct {
ChatID string `json:"chatid" form:"chatid"`
MsgType string `json:"msgtype" form:"msgtype"`
Text MsgSendReqText `json:"text" form:"test"`
Safe int `json:"safe" form:"safe"`
}
// MsgSendPersonReq send msg to person request model
type MsgSendPersonReq struct {
Users []string `json:"touser"`
Content string `json:"content"`
}
//MsgSendReqText MegSendReq test
type MsgSendReqText struct {
Content string `json:"content"`
}
//MsgSendRes message send response
type MsgSendRes struct {
Code int `json:"code"`
Message string `json:"message"`
TTL int `json:"ttl"`
Data WechatMegSendResData `json:"data"`
}
//WechatMegSendResData message send response data of wechat
type WechatMegSendResData struct {
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
}