Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

types.go 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. package types
  2. import (
  3. "time"
  4. "git.x2erp.com/qdy/go-base/ctx"
  5. )
  6. // ExchangeRequest 创建交换机的请求
  7. type ExchangeRequest struct {
  8. ChannelName string `json:"channel_name"`
  9. ExchangeName string `json:"exchange_name"`
  10. ExchangeType string `json:"exchange_type"` // direct, fanout, topic, headers
  11. Durable bool `json:"durable"`
  12. Internal bool `json:"internal"`
  13. AutoDelete bool `json:"auto_delete"`
  14. NoWait bool `json:"no_wait"`
  15. Arguments map[string]string `json:"arguments"`
  16. }
  17. // QueueRequest 创建队列的请求
  18. type QueueRequest struct {
  19. ChannelName string `json:"channel_name"`
  20. QueueName string `json:"queue_name"`
  21. Durable bool `json:"durable"`
  22. Exclusive bool `json:"exclusive"`
  23. AutoDelete bool `json:"auto_delete"`
  24. NoWait bool `json:"no_wait"`
  25. Url string `json:"url"`
  26. Concurrency int `json:"Concurrency"`
  27. ExchangeName string `json:"exchange_name"`
  28. RoutingKey string `json:"routing_key"`
  29. Arguments map[string]string `json:"arguments"`
  30. }
  31. // BindRequest 绑定队列的请求
  32. type QueueBindRequest struct {
  33. ChannelName string `json:"channel_name"`
  34. QueueName string `json:"queue_name"`
  35. ExchangeName string `json:"exchange_name"`
  36. RoutingKey string `json:"routing_key"`
  37. NoWait bool `json:"no_wait"`
  38. Arguments map[string]string `json:"arguments"`
  39. }
  40. // MessageRequest 发送消息的请求
  41. type MessageRequest struct {
  42. ChannelName string `json:"channel_name"`
  43. ExchangeName string `json:"exchange_name"`
  44. RoutingKey string `json:"routing_key"`
  45. Message interface{} `json:"message"`
  46. ContentType string `json:"content_type"`
  47. Headers map[string]interface{} `json:"headers"`
  48. Priority uint8 `json:"priority"`
  49. CorrelationID string `json:"correlation_id"`
  50. ReplyTo string `json:"reply_to"`
  51. Expiration string `json:"expiration"`
  52. MessageID string `json:"message_id"`
  53. Timestamp time.Time `json:"timestamp"`
  54. Type string `json:"type"`
  55. AppID string `json:"app_id"`
  56. }
  57. // BytesMessageRequest 发送字节消息的请求
  58. type BytesMessageRequest struct {
  59. ChannelName string `json:"channel_name"`
  60. ExchangeName string `json:"exchange_name"`
  61. RoutingKey string `json:"routing_key"`
  62. Data []byte `json:"data"`
  63. ContentType string `json:"content_type"`
  64. Headers map[string]string `json:"headers"`
  65. }
  66. // QueueInfoRequest 获取队列信息的请求
  67. type QueueInfoRequest struct {
  68. ChannelName string `json:"channel_name,omitempty"`
  69. QueueName string `json:"queue_name,omitempty"`
  70. }
  71. // RabbitMQResult RabbitMQ操作结果
  72. // type RabbitMQResult struct {
  73. // Success bool `json:"success"`
  74. // Error string `json:"error,omitempty"`
  75. // Data interface{} `json:"data,omitempty"`
  76. // Message string `json:"message,omitempty"`
  77. // Time string `json:"time"`
  78. // Exchange string `json:"exchange,omitempty"`
  79. // Queue string `json:"queue,omitempty"`
  80. // MessageID string `json:"message_id,omitempty"`
  81. // QueueInfo interface{} `json:"queue_info,omitempty"`
  82. // }
  83. // QueryRequest 查询请求
  84. type QueryRequest struct {
  85. SQL string `json:"sql" binding:"required"`
  86. Params map[string]interface{} `json:"params,omitempty"` //名称参数
  87. PositionalParams []interface{} `json:"positionalParams,omitempty"` // 位置参数
  88. WriterHeader bool `json:"writerHeader,omitempty"` //如果查询返回cvs格式时候,包含表头还是不包含。true包含。第一行是表头
  89. AgentUrl string `json:"agentUrl,omitempty"` //远程服务器地址
  90. AgentToken string `json:"agentToken,omitempty"` //远程代理服务器token
  91. DorisDatabase string `json:"dorisDatabase,omitempty"` //doris数据库名称
  92. DorisTable string `json:"dorisTable,omitempty"` //doris数据库里的表名称
  93. }
  94. // QueryResult 查询结果
  95. type QueryResult[T any] struct {
  96. Success bool `json:"success"`
  97. Data T `json:"data,omitempty"`
  98. Error string `json:"error,omitempty"`
  99. Count int `json:"count,omitempty"`
  100. Time string `json:"time,omitempty"`
  101. QueryTime time.Duration `json:"queryTime,omitempty"`
  102. SaveTime time.Duration `json:"saveTime,omitempty"`
  103. TotalCount int `json:"totalCount,omitempty"`
  104. Message string `json:"message,omitempty"`
  105. Metadata *ctx.RequestContext `json:"metadata,omitempty"`
  106. }
  107. // HealthCheck 健康检查
  108. type HealthCheck struct {
  109. Status string `json:"status"`
  110. Timestamp time.Time `json:"timestamp"`
  111. Version string `json:"version"`
  112. }