mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 16:30:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			994 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			994 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package entity
 | 
						|
 | 
						|
import (
 | 
						|
	"mayfly-go/internal/common/utils"
 | 
						|
	"mayfly-go/pkg/model"
 | 
						|
)
 | 
						|
 | 
						|
type Redis struct {
 | 
						|
	model.Model
 | 
						|
 | 
						|
	Name               string `orm:"column(name)" json:"name"`
 | 
						|
	Host               string `orm:"column(host)" json:"host"`
 | 
						|
	Mode               string `json:"mode"`
 | 
						|
	Username           string `json:"username"`
 | 
						|
	Password           string `orm:"column(password)" json:"-"`
 | 
						|
	Db                 string `orm:"column(database)" json:"db"`
 | 
						|
	SshTunnelMachineId int    `orm:"column(ssh_tunnel_machine_id)" json:"sshTunnelMachineId"` // ssh隧道机器id
 | 
						|
	Remark             string
 | 
						|
	TagId              uint64
 | 
						|
	TagPath            string
 | 
						|
}
 | 
						|
 | 
						|
const (
 | 
						|
	RedisModeStandalone = "standalone"
 | 
						|
	RedisModeCluster    = "cluster"
 | 
						|
	RedisModeSentinel   = "sentinel"
 | 
						|
)
 | 
						|
 | 
						|
func (r *Redis) PwdEncrypt() {
 | 
						|
	// 密码替换为加密后的密码
 | 
						|
	r.Password = utils.PwdAesEncrypt(r.Password)
 | 
						|
}
 | 
						|
 | 
						|
func (r *Redis) PwdDecrypt() {
 | 
						|
	// 密码替换为解密后的密码
 | 
						|
	r.Password = utils.PwdAesDecrypt(r.Password)
 | 
						|
}
 |