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

Method WriteArg

internal/proto/writer.go:62–200  ·  view source on GitHub ↗
(v interface{})

Source from the content-addressed store, hash-verified

60}
61
62func (w *Writer) WriteArg(v interface{}) error {
63 switch v := v.(type) {
64 case nil:
65 return w.string("")
66 case string:
67 return w.string(v)
68 case *string:
69 if v == nil {
70 return w.string("")
71 }
72 return w.string(*v)
73 case []byte:
74 return w.bytes(v)
75 case int:
76 return w.int(int64(v))
77 case *int:
78 if v == nil {
79 return w.int(0)
80 }
81 return w.int(int64(*v))
82 case int8:
83 return w.int(int64(v))
84 case *int8:
85 if v == nil {
86 return w.int(0)
87 }
88 return w.int(int64(*v))
89 case int16:
90 return w.int(int64(v))
91 case *int16:
92 if v == nil {
93 return w.int(0)
94 }
95 return w.int(int64(*v))
96 case int32:
97 return w.int(int64(v))
98 case *int32:
99 if v == nil {
100 return w.int(0)
101 }
102 return w.int(int64(*v))
103 case int64:
104 return w.int(v)
105 case *int64:
106 if v == nil {
107 return w.int(0)
108 }
109 return w.int(*v)
110 case uint:
111 return w.uint(uint64(v))
112 case *uint:
113 if v == nil {
114 return w.uint(0)
115 }
116 return w.uint(uint64(*v))
117 case uint8:
118 return w.uint(uint64(v))
119 case *uint8:

Callers 2

WriteArgsMethod · 0.95
writer_test.goFile · 0.80

Calls 6

stringMethod · 0.95
bytesMethod · 0.95
intMethod · 0.95
uintMethod · 0.95
floatMethod · 0.95
MarshalBinaryMethod · 0.45

Tested by

no test coverage detected