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

Method String

datastore/query.go:743–755  ·  view source on GitHub ↗

String returns a base-64 string representation of a cursor.

()

Source from the content-addressed store, hash-verified

741
742// String returns a base-64 string representation of a cursor.
743func (c Cursor) String() string {
744 if c.cc == nil {
745 return ""
746 }
747 b, err := proto.Marshal(c.cc)
748 if err != nil {
749 // The only way to construct a Cursor with a non-nil cc field is to
750 // unmarshal from the byte representation. We panic if the unmarshal
751 // succeeds but the marshaling of the unchanged protobuf value fails.
752 panic(fmt.Sprintf("datastore: internal error: malformed cursor: %v", err))
753 }
754 return strings.TrimRight(base64.URLEncoding.EncodeToString(b), "=")
755}
756
757// DecodeCursor decodes a cursor from its base-64 string representation.
758func DecodeCursor(s string) (Cursor, error) {

Callers 1

toProtoMethod · 0.45

Calls 1

MarshalMethod · 0.80

Tested by

no test coverage detected