Files
mayfly-go/server/internal/redis/domain/entity/redis.go

33 lines
1.2 KiB
Go
Raw Normal View History

package entity
import (
"mayfly-go/internal/redis/rdm"
tagentity "mayfly-go/internal/tag/domain/entity"
"mayfly-go/pkg/model"
"mayfly-go/pkg/utils/structx"
)
type Redis struct {
model.Model
Code string `orm:"column(code)" json:"code"`
2022-10-26 20:49:29 +08:00
Name string `orm:"column(name)" json:"name"`
Host string `orm:"column(host)" json:"host"`
Mode string `json:"mode"`
2022-09-29 13:14:50 +08:00
Db string `orm:"column(database)" json:"db"`
SshTunnelMachineId int `orm:"column(ssh_tunnel_machine_id)" json:"sshTunnelMachineId"` // ssh隧道机器id
Remark string
2024-03-02 19:08:19 +08:00
FlowProcdefKey *string `json:"flowProcdefKey"` // 审批流-流程定义key有值则说明关键操作需要进行审批执行,使用指针为了方便更新空字符串(取消流程审批)
}
// ToRedisInfo 转换为redisInfo进行连接
func (r *Redis) ToRedisInfo(db int, authCert *tagentity.ResourceAuthCert, tagPath ...string) *rdm.RedisInfo {
redisInfo := new(rdm.RedisInfo)
_ = structx.Copy(redisInfo, r)
redisInfo.Username = authCert.Username
redisInfo.Password = authCert.Ciphertext
redisInfo.Db = db
redisInfo.TagPath = tagPath
return redisInfo
}