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

Method BitFieldRO

bitmap_commands.go:182–197  ·  view source on GitHub ↗

BitFieldRO - Read-only variant of the BITFIELD command. It is like the original BITFIELD but only accepts GET subcommand and can safely be used in read-only replicas. - BitFieldRO(ctx, key, " ", " ", " "," ")

(ctx context.Context, key string, values ...interface{})

Source from the content-addressed store, hash-verified

180// It is like the original BITFIELD but only accepts GET subcommand and can safely be used in read-only replicas.
181// - BitFieldRO(ctx, key, "<Encoding0>", "<Offset0>", "<Encoding1>","<Offset1>")
182func (c cmdable) BitFieldRO(ctx context.Context, key string, values ...interface{}) *IntSliceCmd {
183 args := make([]interface{}, 2, 2+len(values))
184 args[0] = "BITFIELD_RO"
185 args[1] = key
186 if len(values)%2 != 0 {
187 c := NewIntSliceCmd(ctx)
188 c.SetErr(errors.New("BitFieldRO: invalid number of arguments, must be even"))
189 return c
190 }
191 for i := 0; i < len(values); i += 2 {
192 args = append(args, "GET", values[i], values[i+1])
193 }
194 cmd := NewIntSliceCmd(ctx, args...)
195 _ = c(ctx, cmd)
196 return cmd
197}

Callers

nothing calls this directly

Calls 2

NewIntSliceCmdFunction · 0.85
SetErrMethod · 0.65

Tested by

no test coverage detected