ClientSetInfo sends a CLIENT SETINFO command with the provided info.
(ctx context.Context, info LibraryInfo)
| 324 | |
| 325 | // ClientSetInfo sends a CLIENT SETINFO command with the provided info. |
| 326 | func (c statefulCmdable) ClientSetInfo(ctx context.Context, info LibraryInfo) *StatusCmd { |
| 327 | err := info.Validate() |
| 328 | if err != nil { |
| 329 | panic(err.Error()) |
| 330 | } |
| 331 | |
| 332 | var cmd *StatusCmd |
| 333 | if info.LibName != nil { |
| 334 | libName := fmt.Sprintf("go-redis(%s,%s)", *info.LibName, internal.ReplaceSpaces(runtime.Version())) |
| 335 | cmd = NewStatusCmd(ctx, "client", "setinfo", "LIB-NAME", libName) |
| 336 | } else { |
| 337 | cmd = NewStatusCmd(ctx, "client", "setinfo", "LIB-VER", *info.LibVer) |
| 338 | } |
| 339 | |
| 340 | _ = c(ctx, cmd) |
| 341 | return cmd |
| 342 | } |
| 343 | |
| 344 | // Validate checks if only one field in the struct is non-nil. |
| 345 | func (info LibraryInfo) Validate() error { |
nothing calls this directly
no test coverage detected