2021-07-28 18:03:19 +08:00
|
|
|
package entity
|
|
|
|
|
|
|
|
|
|
import (
|
2022-08-02 21:44:01 +08:00
|
|
|
"mayfly-go/internal/common/utils"
|
2022-06-02 17:41:11 +08:00
|
|
|
"mayfly-go/pkg/model"
|
2021-07-28 18:03:19 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Redis struct {
|
|
|
|
|
model.Model
|
|
|
|
|
|
2022-10-26 20:49:29 +08:00
|
|
|
Name string `orm:"column(name)" json:"name"`
|
2022-07-20 23:25:52 +08:00
|
|
|
Host string `orm:"column(host)" json:"host"`
|
|
|
|
|
Mode string `json:"mode"`
|
2023-07-20 22:41:13 +08:00
|
|
|
Username string `json:"username"`
|
2022-07-20 23:25:52 +08:00
|
|
|
Password string `orm:"column(password)" json:"-"`
|
2022-09-29 13:14:50 +08:00
|
|
|
Db string `orm:"column(database)" json:"db"`
|
2023-03-06 16:59:57 +08:00
|
|
|
SshTunnelMachineId int `orm:"column(ssh_tunnel_machine_id)" json:"sshTunnelMachineId"` // ssh隧道机器id
|
2022-07-20 23:25:52 +08:00
|
|
|
Remark string
|
2022-10-26 20:49:29 +08:00
|
|
|
TagId uint64
|
|
|
|
|
TagPath string
|
2021-07-28 18:03:19 +08:00
|
|
|
}
|
2022-07-10 12:14:06 +08:00
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
RedisModeStandalone = "standalone"
|
|
|
|
|
RedisModeCluster = "cluster"
|
2022-08-23 18:50:07 +08:00
|
|
|
RedisModeSentinel = "sentinel"
|
2022-07-10 12:14:06 +08:00
|
|
|
)
|
2022-08-02 21:44:01 +08:00
|
|
|
|
|
|
|
|
func (r *Redis) PwdEncrypt() {
|
|
|
|
|
// 密码替换为加密后的密码
|
|
|
|
|
r.Password = utils.PwdAesEncrypt(r.Password)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *Redis) PwdDecrypt() {
|
|
|
|
|
// 密码替换为解密后的密码
|
|
|
|
|
r.Password = utils.PwdAesDecrypt(r.Password)
|
|
|
|
|
}
|