MCPcopy Create free account
hub / github.com/segmentio/encoding / Value

Method Value

proto/message.go:109–136  ·  view source on GitHub ↗

Value constructs a RawMessage for field number f from v.

(v any)

Source from the content-addressed store, hash-verified

107
108// Value constructs a RawMessage for field number f from v.
109func (f FieldNumber) Value(v any) RawMessage {
110 switch x := v.(type) {
111 case bool:
112 return f.Bool(x)
113 case int:
114 return f.Int(x)
115 case int32:
116 return f.Int32(x)
117 case int64:
118 return f.Int64(x)
119 case uint:
120 return f.Uint(x)
121 case uint32:
122 return f.Uint32(x)
123 case uint64:
124 return f.Uint64(x)
125 case float32:
126 return f.Float32(x)
127 case float64:
128 return f.Float64(x)
129 case string:
130 return f.String(x)
131 case []byte:
132 return f.Bytes(x)
133 default:
134 panic("cannot rewrite value of unsupported type")
135 }
136}
137
138// The WireType enumeration represents the different protobuf wire types.
139type WireType uint

Callers 1

encodeFuncMapOfFunction · 0.45

Calls 11

BoolMethod · 0.95
IntMethod · 0.95
Int32Method · 0.95
Int64Method · 0.95
UintMethod · 0.95
Uint32Method · 0.95
Uint64Method · 0.95
Float32Method · 0.95
Float64Method · 0.95
StringMethod · 0.95
BytesMethod · 0.95

Tested by

no test coverage detected