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

Method Encode

docstore/gcpfirestore/native_codec_test.go:113–119  ·  view source on GitHub ↗

Encode a Go value into a Firestore proto document.

(x any)

Source from the content-addressed store, hash-verified

111
112// Encode a Go value into a Firestore proto document.
113func (c *nativeCodec) Encode(x any) (*pb.Document, error) {
114 _, err := c.client.Collection("C").Doc("D").Create(context.Background(), x)
115 if err != nil {
116 return nil, err
117 }
118 return c.doc, nil
119}
120
121// Decode value, which must be a *pb.Document, into dest.
122func (c *nativeCodec) Decode(value *pb.Document, dest any) error {

Callers 4

NativeEncodeMethod · 0.45
DocstoreEncodeMethod · 0.45
encodeDocFunction · 0.45
TestNativeCodecFunction · 0.45

Calls 1

CreateMethod · 0.45

Tested by

no test coverage detected