MCPcopy Create free account
hub / github.com/google/go-cloud / encodeValue

Function encodeValue

docstore/gcpfirestore/codec.go:50–56  ·  view source on GitHub ↗

encodeValue encodes a Go value as a Firestore Value. The Firestore proto definition for Value is a oneof of various types, including basic types like string as well as lists and maps.

(x any)

Source from the content-addressed store, hash-verified

48// The Firestore proto definition for Value is a oneof of various types,
49// including basic types like string as well as lists and maps.
50func encodeValue(x any) (*pb.Value, error) {
51 var e encoder
52 if err := driver.Encode(reflect.ValueOf(x), &e); err != nil {
53 return nil, err
54 }
55 return e.pv, nil
56}
57
58// encoder implements driver.Encoder. Its job is to encode a single Firestore value.
59type encoder struct {

Callers 2

filterToProtoMethod · 0.70
processModsFunction · 0.70

Calls 1

EncodeFunction · 0.92

Tested by

no test coverage detected