MCPcopy
hub / github.com/redis/go-redis / ClientSetInfo

Method ClientSetInfo

commands.go:326–342  ·  view source on GitHub ↗

ClientSetInfo sends a CLIENT SETINFO command with the provided info.

(ctx context.Context, info LibraryInfo)

Source from the content-addressed store, hash-verified

324
325// ClientSetInfo sends a CLIENT SETINFO command with the provided info.
326func (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.
345func (info LibraryInfo) Validate() error {

Callers

nothing calls this directly

Calls 4

ReplaceSpacesFunction · 0.92
NewStatusCmdFunction · 0.85
ValidateMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected