MCPcopy Create free account
hub / github.com/golang/appengine / Encode

Method Encode

datastore/key.go:231–241  ·  view source on GitHub ↗

Encode returns an opaque representation of the key suitable for use in HTML and URLs. This is compatible with the Python and Java runtimes.

()

Source from the content-addressed store, hash-verified

229// suitable for use in HTML and URLs.
230// This is compatible with the Python and Java runtimes.
231func (k *Key) Encode() string {
232 ref := keyToProto("", k)
233
234 b, err := proto.Marshal(ref)
235 if err != nil {
236 panic(err)
237 }
238
239 // Trailing padding is stripped.
240 return strings.TrimRight(base64.URLEncoding.EncodeToString(b), "=")
241}
242
243// DecodeKey decodes a key from the opaque representation returned by Encode.
244func DecodeKey(encoded string) (*Key, error) {

Callers 9

TestKeyJSONFunction · 0.95
MarshalJSONMethod · 0.95
TaskMethod · 0.45
TestKeyEncodingFunction · 0.45
TestKeyGobFunction · 0.45
TestNilKeyGobFunction · 0.45
GobEncodeMethod · 0.45
gobMarshalFunction · 0.45
NewPOSTTaskFunction · 0.45

Calls 2

MarshalMethod · 0.80
keyToProtoFunction · 0.70

Tested by 4

TestKeyJSONFunction · 0.76
TestKeyEncodingFunction · 0.36
TestKeyGobFunction · 0.36
TestNilKeyGobFunction · 0.36