MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / Write

Function Write

IceFireDB-PubSub/test/proto/proto.go:221–231  ·  view source on GitHub ↗

Write a command in RESP3 proto. Used to write commands to redis. Currently only supports string arrays.

(w io.Writer, cmd []string)

Source from the content-addressed store, hash-verified

219// Write a command in RESP3 proto. Used to write commands to redis.
220// Currently only supports string arrays.
221func Write(w io.Writer, cmd []string) error {
222 if _, err := fmt.Fprintf(w, "*%d\r\n", len(cmd)); err != nil {
223 return err
224 }
225 for _, c := range cmd {
226 if _, err := fmt.Fprintf(w, "$%d\r\n%s\r\n", len(c), c); err != nil {
227 return err
228 }
229 }
230 return nil
231}
232
233// Parse into interfaces. `b` must contain exactly a single command (which can be nested).
234func Parse(b string) (any, error) {

Callers 2

TestWriteFunction · 0.70
DoMethod · 0.70

Calls

no outgoing calls

Tested by 1

TestWriteFunction · 0.56