MCPcopy Create free account
hub / github.com/aws/smithy-go / encodeScalar

Method encodeScalar

document/cbor/encode.go:175–184  ·  view source on GitHub ↗
(rv reflect.Value)

Source from the content-addressed store, hash-verified

173}
174
175func (e *encoder) encodeScalar(rv reflect.Value) (cbor.Value, error) {
176 switch rv.Kind() {
177 case reflect.Bool:
178 return cbor.Bool(rv.Bool()), nil
179 case reflect.String:
180 return cbor.String(rv.String()), nil
181 default:
182 return e.encodeNumber(rv)
183 }
184}
185
186func (e *encoder) encodeNumber(rv reflect.Value) (cbor.Value, error) {
187 const tagbigpos = 2

Callers 1

encodeMethod · 0.95

Calls 4

encodeNumberMethod · 0.95
BoolTypeAlias · 0.92
StringTypeAlias · 0.92
StringMethod · 0.65

Tested by

no test coverage detected