mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
36
server/internal/es/domain/entity/es_instance.go
Normal file
36
server/internal/es/domain/entity/es_instance.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"mayfly-go/pkg/model"
|
||||
)
|
||||
|
||||
type EsInstance struct {
|
||||
model.Model
|
||||
|
||||
Code string `json:"code" gorm:"size:32;not null;"`
|
||||
Name string `json:"name" gorm:"size:32;not null;"`
|
||||
Host string `json:"host" gorm:"size:255;not null;"`
|
||||
Port int `json:"port"`
|
||||
Network string `json:"network" gorm:"size:20;"`
|
||||
Version string `json:"version" gorm:"size:50;"`
|
||||
AuthCertName string `json:"authCertName" gorm:"size:255;"`
|
||||
SshTunnelMachineId int `json:"sshTunnelMachineId"` // ssh隧道机器id
|
||||
}
|
||||
|
||||
func (d *EsInstance) TableName() string {
|
||||
return "t_es_instance"
|
||||
}
|
||||
|
||||
// 获取es连接网络, 若没有使用ssh隧道,则直接返回。否则返回拼接的网络需要注册至指定dial
|
||||
func (d *EsInstance) GetNetwork() string {
|
||||
network := d.Network
|
||||
if d.SshTunnelMachineId <= 0 {
|
||||
if network == "" {
|
||||
return "tcp"
|
||||
} else {
|
||||
return network
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("es+ssh:%d", d.SshTunnelMachineId)
|
||||
}
|
||||
16
server/internal/es/domain/entity/query.go
Normal file
16
server/internal/es/domain/entity/query.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package entity
|
||||
|
||||
import "mayfly-go/pkg/model"
|
||||
|
||||
// InstanceQuery 数据库实例查询
|
||||
type InstanceQuery struct {
|
||||
model.PageParam
|
||||
|
||||
Id uint64 `json:"id" form:"id"`
|
||||
Name string `json:"name" form:"name"`
|
||||
Code string `json:"code" form:"code"`
|
||||
Host string `json:"host" form:"host"`
|
||||
TagPath string `json:"tagPath" form:"tagPath"`
|
||||
Keyword string `json:"keyword" form:"keyword"`
|
||||
Codes []string
|
||||
}
|
||||
Reference in New Issue
Block a user