script.go 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. package model
  2. import (
  3. "time"
  4. )
  5. //Script script
  6. type Script struct {
  7. ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key;" form:"id"`
  8. TreeID int `json:"tree_id"`
  9. ProjectID int `json:"project_id" form:"project_id"`
  10. Type int `json:"type" form:"type"`
  11. ProjectName string `json:"project_name" form:"project_name"`
  12. TestName string `json:"test_name" form:"test_name"`
  13. ThreadsSum int `json:"threads_sum" form:"threads_sum"`
  14. LoadTime int `json:"load_time"`
  15. ReadyTime int `json:"ready_time"`
  16. ProcType string `json:"proc_type"`
  17. URL string `json:"url" form:"url" gorm:"url"`
  18. Domain string `json:"domain" form:"domain"`
  19. Port string `json:"port"`
  20. Login bool `json:"login"`
  21. Path string `json:"path"`
  22. Method string `json:"method" form:"method"`
  23. Cookie string `json:"cookie" form:"cookie"`
  24. ContentType string `json:"content_type"`
  25. Data string `json:"data" form:"data"`
  26. Assertion string `json:"assertion"`
  27. AssertionString interface{} `json:"assertion_string" gorm:"-"`
  28. UseAssertion bool `json:"use_assertion" gorm:"-"`
  29. UseBuiltinParam bool `json:"use_builtin_param" gorm:"-"`
  30. SavePath string `json:"save_path" form:"save_path"`
  31. ResJtl string `json:"res_jtl" form:"res_jtl"`
  32. JmeterLog string `json:"jmeter_log"`
  33. UpdateBy string `json:"update_by" form:"update_by"`
  34. Ctime time.Time `json:"ctime" form:"ctime"`
  35. Mtime time.Time `json:"mtime" form:"mtime"`
  36. Active int `json:"active"`
  37. Upload bool `json:"upload" form:"upload"`
  38. Headers []map[string]string `json:"headers" form:"headers" gorm:"-"` // true
  39. APIHeader string `json:"api_header"`
  40. ArgumentsMap []map[string]string `json:"arguments_map" gorm:"-"` // true
  41. ArgumentString string `gorm:"column:argument_map"`
  42. RowQuery string `json:"row_query" form:"row_query" gorm:"-"`
  43. UseSign bool `json:"use_sign" form:"use_sign"`
  44. LabelIds []int `json:"label_ids" form:"label_ids" gorm:"-"`
  45. IsCopy bool `json:"is_copy" form:"is_copy" gorm:"-"`
  46. ConnTimeOut int `json:"conn_time_out"`
  47. RespTimeOut int `json:"resp_time_out"`
  48. IsSave bool `json:"is_save" gorm:"-"`
  49. TestType int `json:"test_type" form:"test_type"`
  50. SceneID int `json:"scene_id" form:"scene_id"`
  51. OutputParamsMap []map[string]string `json:"output_params_map" form:"output_params_map" gorm:"-"`
  52. OutputParams string `json:"output_params" form:"output_params"`
  53. JSONPath string `json:"json_path"`
  54. GroupID int `json:"group_id" form:"group_id"`
  55. RunOrder int `json:"run_order" form:"run_order"`
  56. ScriptPath string `json:"script_path" form:"script_path"`
  57. JmeterSample interface{} `json:"jmeter_sample" gorm:"-"`
  58. JSONExtractor interface{} `json:"json_extractor" gorm:"-"`
  59. IsAsync bool `json:"is_async" form:"is_async"`
  60. AsyncInfo interface{} `json:"async_info" gorm:"-"`
  61. MultiPartInfo interface{} `json:"multi_part_info" gorm:"-"`
  62. UseMultipart bool `json:"use_multipart" gorm:"-"`
  63. MultipartPath string `json:"multipart_path"`
  64. MultipartFile string `json:"multipart_file"`
  65. MultipartParam string `json:"multipart_param"`
  66. MimeType string `json:"mime_type"`
  67. Fusing int `json:"fusing"`
  68. UseBusinessStop bool `json:"use_business_stop" form:"use_business_stop"`
  69. BusinessStopPercent int `json:"business_stop_percent" form:"business_stop_percent"`
  70. KeepAlive bool `json:"keep_alive" form:"keep_alive"`
  71. ExecuDockerSum int `json:"execu_docker_sum" gorm:"-"`
  72. ConstTimer int `json:"const_timer"`
  73. ConstTimerInfo interface{} `json:"const_timer_info" gorm:"-"`
  74. RandomTimer int `json:"random_timer"`
  75. RandomTimerInfo interface{} `json:"random_timer_info" gorm:"-"`
  76. DataFile
  77. TreePath
  78. }
  79. //APIH api headers
  80. type APIH struct {
  81. APIHeader []map[string]string `json:"api_header"`
  82. }
  83. //ScriptScene script scene
  84. type ScriptScene struct {
  85. Scripts []Script `json:"scripts" form:"scripts"`
  86. }
  87. // TreePath service tree
  88. type TreePath struct {
  89. Department string `json:"department" form:"department"`
  90. Project string `json:"project" form:"project"`
  91. App string `json:"app" form:"app"`
  92. }
  93. //QueryScriptResponse query script response
  94. type QueryScriptResponse struct {
  95. Scripts []*ScriptLabels `json:"scripts"`
  96. Pagination
  97. }
  98. //ScriptLabels script labels
  99. type ScriptLabels struct {
  100. Script
  101. Labels []*LabelRelation `json:"labels"`
  102. }
  103. //DataFile ignore db
  104. type DataFile struct {
  105. UseDataFile bool `json:"use_data_file" gorm:"use_data_file"` // true
  106. FileName string `json:"file_name" gorm:"file_name"` // true
  107. ParamsName string `json:"params_name" gorm:"params_name"` // true
  108. Delimiter string `json:"delimiter" gorm:"delimiter"` // true
  109. Loops int `json:"loops" gorm:"loops"` // true
  110. ResLog string `json:"res_log" gorm:"-"`
  111. BeginTestName string `json:"begin_test_name" gorm:"-"`
  112. IsDebug bool `json:"is_debug" gorm:"-"`
  113. HeaderString interface{} `json:"header_string" gorm:"-"`
  114. Arguments interface{} `json:"arguments" gorm:"-"`
  115. FileSplit bool `json:"file_split" form:"file_split"`
  116. SplitNum int `json:"split_num" form:"split_num"`
  117. }
  118. //QueryScriptRequest query script request
  119. type QueryScriptRequest struct {
  120. Script
  121. Pagination
  122. Executor string `json:"executor" form:"executor"`
  123. }
  124. //ScrThreadGroup script thread group
  125. type ScrThreadGroup struct {
  126. Scripts []*Script `json:"scripts"`
  127. }
  128. //URLEncode URL Encode
  129. type URLEncode struct {
  130. ParamsType string `json:"params_type"`
  131. NewUrl string `json:"new_url"`
  132. }
  133. //TableName db table name of script
  134. func (st Script) TableName() string {
  135. return "script"
  136. }
  137. // FusingInfo Fusing List
  138. type FusingInfo struct {
  139. Fusing int `json:"fusing"`
  140. }
  141. // FusingInfoList Fusing Info List
  142. type FusingInfoList struct {
  143. FusingList []FusingInfo `json:"fusing_list"`
  144. SetNull bool `json:"set_null"`
  145. }