Files
be.ems/src/modules/network_element/model/ne_host.go
2024-10-16 16:40:11 +08:00

42 lines
2.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import "encoding/json"
// NeHost 网元主机表 ne_host
type NeHost struct {
HostID string `json:"hostId" gorm:"column:host_id"` // 主机主键
HostType string `json:"hostType" gorm:"column:host_type" binding:"oneof=ssh telnet redis"` // 连接类型 ssh telnet redis
GroupID string `json:"groupId" gorm:"column:group_id"` // 分组0默认 1网元 2系统
Title string `json:"title" gorm:"column:title"` // 标题名称
Addr string `json:"addr" gorm:"column:addr" binding:"required"` // 主机地址
Port int64 `json:"port" gorm:"column:port" binding:"required,number,max=65535,min=1"` // 端口 22 4100 6379
User string `json:"user" gorm:"column:user" binding:"required"` // 认证用户名
AuthMode string `json:"authMode" gorm:"column:auth_mode" binding:"oneof=0 1 2"` // 认证模式0密码 1主机私钥 2已免密
Password string `json:"password" gorm:"column:password"` // 认证密码
PrivateKey string `json:"privateKey" gorm:"column:private_key"` // 认证私钥
PassPhrase string `json:"passPhrase" gorm:"column:pass_phrase"` // 认证私钥密码
DBName string `json:"dbName" gorm:"column:db_name"` // 数据库名称
Remark string `json:"remark" gorm:"column:remark"` // 备注
CreateBy string `json:"createBy" gorm:"column:create_by"` // 创建者
CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间
UpdateBy string `json:"updateBy" gorm:"column:update_by"` // 更新者
UpdateTime int64 `json:"updateTime" gorm:"column:update_time"` // 更新时间
}
// TableName 表名称
func (*NeHost) TableName() string {
return "ne_host"
}
// CopyTo 网元主机信息将josn同key名的结构体复制给另一个结构体
func (m *NeHost) CopyTo(to interface{}) error {
b, err := json.Marshal(m)
if err != nil {
return err
}
if err = json.Unmarshal(b, to); err != nil {
return err
}
return nil
}