如何包裝redis.Client到我的struct? 我有那個代碼并給我一個錯誤package mainimport ( "github.com/go-redis/redis")var cache *RedisCache// RedisCache structtype RedisCache struct { *redis.Client}func initCache() *RedisCache { if cache == nil { cache = redis.NewClient(&redis.Options{ Addr: "localhost:6379", Password: "", DB: 0, }) } return cache}cannot use redis.NewClient(&redis.Options literal) (type *redis.Client) as type *RedisCache in assignment有一些方法可以轉換該屬性嗎?
在 go 中使用 struct 作為包裝器
慕桂英3389331
2022-07-11 15:31:58
