mirror of
https://github.com/redis/go-redis.git
synced 2025-06-12 14:21:52 +03:00
Add helpers to set libinfo without panic (#2724)
* add helpers to set library name and library info without risk of panic if we try to set both * refactor code to use helpers * add example * refactor tests * fix testable example * simplify example * rename exampl * fix ring.go * update example --------- Co-authored-by: ofekshenawa <104765379+ofekshenawa@users.noreply.github.com>
This commit is contained in:
@ -248,7 +248,7 @@ var _ = Describe("Commands", func() {
|
||||
|
||||
// Test setting the libName
|
||||
libName := "go-redis"
|
||||
libInfo := redis.LibraryInfo{LibName: &libName}
|
||||
libInfo := redis.WithLibraryName(libName)
|
||||
setInfo := pipe.ClientSetInfo(ctx, libInfo)
|
||||
_, err := pipe.Exec(ctx)
|
||||
|
||||
@ -258,7 +258,7 @@ var _ = Describe("Commands", func() {
|
||||
|
||||
// Test setting the libVer
|
||||
libVer := "vX.x"
|
||||
libInfo = redis.LibraryInfo{LibVer: &libVer}
|
||||
libInfo = redis.WithLibraryVersion(libVer)
|
||||
setInfo = pipe.ClientSetInfo(ctx, libInfo)
|
||||
_, err = pipe.Exec(ctx)
|
||||
|
||||
|
Reference in New Issue
Block a user