package types import ( "time" "git.x2erp.com/qdy/go-base/ctx" ) // ExchangeRequest 创建交换机的请求 type ExchangeRequest struct { ChannelName string `json:"channel_name"` ExchangeName string `json:"exchange_name"` ExchangeType string `json:"exchange_type"` // direct, fanout, topic, headers Durable bool `json:"durable"` Internal bool `json:"internal"` AutoDelete bool `json:"auto_delete"` NoWait bool `json:"no_wait"` Arguments map[string]string `json:"arguments"` } // QueueRequest 创建队列的请求 type QueueRequest struct { ChannelName string `json:"channel_name"` QueueName string `json:"queue_name"` Durable bool `json:"durable"` Exclusive bool `json:"exclusive"` AutoDelete bool `json:"auto_delete"` NoWait bool `json:"no_wait"` Url string `json:"url"` Concurrency int `json:"Concurrency"` ExchangeName string `json:"exchange_name"` RoutingKey string `json:"routing_key"` Arguments map[string]string `json:"arguments"` } // BindRequest 绑定队列的请求 type QueueBindRequest struct { ChannelName string `json:"channel_name"` QueueName string `json:"queue_name"` ExchangeName string `json:"exchange_name"` RoutingKey string `json:"routing_key"` NoWait bool `json:"no_wait"` Arguments map[string]string `json:"arguments"` } // MessageRequest 发送消息的请求 type MessageRequest struct { ChannelName string `json:"channel_name"` ExchangeName string `json:"exchange_name"` RoutingKey string `json:"routing_key"` Message interface{} `json:"message"` ContentType string `json:"content_type"` Headers map[string]interface{} `json:"headers"` Priority uint8 `json:"priority"` CorrelationID string `json:"correlation_id"` ReplyTo string `json:"reply_to"` Expiration string `json:"expiration"` MessageID string `json:"message_id"` Timestamp time.Time `json:"timestamp"` Type string `json:"type"` AppID string `json:"app_id"` } // BytesMessageRequest 发送字节消息的请求 type BytesMessageRequest struct { ChannelName string `json:"channel_name"` ExchangeName string `json:"exchange_name"` RoutingKey string `json:"routing_key"` Data []byte `json:"data"` ContentType string `json:"content_type"` Headers map[string]string `json:"headers"` } // QueueInfoRequest 获取队列信息的请求 type QueueInfoRequest struct { ChannelName string `json:"channel_name,omitempty"` QueueName string `json:"queue_name,omitempty"` } // RabbitMQResult RabbitMQ操作结果 // type RabbitMQResult struct { // Success bool `json:"success"` // Error string `json:"error,omitempty"` // Data interface{} `json:"data,omitempty"` // Message string `json:"message,omitempty"` // Time string `json:"time"` // Exchange string `json:"exchange,omitempty"` // Queue string `json:"queue,omitempty"` // MessageID string `json:"message_id,omitempty"` // QueueInfo interface{} `json:"queue_info,omitempty"` // } // QueryRequest 查询请求 type QueryRequest struct { SQL string `json:"sql" binding:"required"` Params map[string]interface{} `json:"params,omitempty"` //名称参数 PositionalParams []interface{} `json:"positionalParams,omitempty"` // 位置参数 WriterHeader bool `json:"writerHeader,omitempty"` //如果查询返回cvs格式时候,包含表头还是不包含。true包含。第一行是表头 AgentUrl string `json:"agentUrl,omitempty"` //远程服务器地址 AgentToken string `json:"agentToken,omitempty"` //远程代理服务器token DorisDatabase string `json:"dorisDatabase,omitempty"` //doris数据库名称 DorisTable string `json:"dorisTable,omitempty"` //doris数据库里的表名称 } // QueryResult 查询结果 type QueryResult[T any] struct { Success bool `json:"success"` Data T `json:"data,omitempty"` Error string `json:"error,omitempty"` Count int `json:"count,omitempty"` Time string `json:"time,omitempty"` QueryTime time.Duration `json:"queryTime,omitempty"` SaveTime time.Duration `json:"saveTime,omitempty"` TotalCount int `json:"totalCount,omitempty"` Message string `json:"message,omitempty"` Metadata *ctx.RequestContext `json:"metadata,omitempty"` } // HealthCheck 健康检查 type HealthCheck struct { Status string `json:"status"` Timestamp time.Time `json:"timestamp"` Version string `json:"version"` }