Documentation
¶
Index ¶
- Variables
- func Encode(ctx context.Context, key Key) string
- func Encode64(key Key) string
- func Exists(ctx context.Context, key interface{}) (bool, error)
- type DatastoreKey
- func Decode(ctx context.Context, encoded string) (*DatastoreKey, error)
- func Decode64(ctx context.Context, encoded string) (*DatastoreKey, error)
- func DecodeKey(ctx context.Context, encoded string) (*DatastoreKey, error)
- func FromDBKey(key db.Key) *DatastoreKey
- func New(ctx context.Context, kind string, id interface{}, parent Key) *DatastoreKey
- func NewFromId(ctx context.Context, id string) *DatastoreKey
- func NewFromInt(ctx context.Context, kind string, intid interface{}, parent Key) (*DatastoreKey, error)
- func NewIncompleteKey(ctx context.Context, kind string, parent Key) *DatastoreKey
- func NewKey(ctx context.Context, kind, stringID string, intID int64, parent Key) *DatastoreKey
- func ToDatastoreKey(key Key) *DatastoreKey
- func (k *DatastoreKey) AppID() string
- func (k *DatastoreKey) Encode() string
- func (k *DatastoreKey) Equal(o Key) bool
- func (k *DatastoreKey) GobDecode(buf []byte) error
- func (k *DatastoreKey) GobEncode() ([]byte, error)
- func (k *DatastoreKey) Incomplete() bool
- func (k *DatastoreKey) IntID() int64
- func (k *DatastoreKey) Kind() string
- func (k *DatastoreKey) MarshalJSON() ([]byte, error)
- func (k *DatastoreKey) Namespace() string
- func (k *DatastoreKey) Parent() Key
- func (k *DatastoreKey) SetIntID(id int64)
- func (k *DatastoreKey) SetNamespace(ns string)
- func (k *DatastoreKey) SetStringID(id string)
- func (k *DatastoreKey) String() string
- func (k *DatastoreKey) StringID() string
- func (k *DatastoreKey) ToDBKey(database db.DB) db.Key
- func (k *DatastoreKey) UnmarshalJSON(buf []byte) error
- type Key
Constants ¶
This section is empty.
Variables ¶
var (
FromId = Decode
)
Functions ¶
Types ¶
type DatastoreKey ¶
type DatastoreKey struct {
// contains filtered or unexported fields
}
DatastoreKey implements the iface.Key interface and provides compatibility with the legacy appengine datastore API.
func Decode ¶
func Decode(ctx context.Context, encoded string) (*DatastoreKey, error)
Decode key using hashid algorithm and falling back to base64 encoding
func Decode64 ¶
func Decode64(ctx context.Context, encoded string) (*DatastoreKey, error)
Decode64 decodes key encoded with base64 encoding
func DecodeKey ¶
func DecodeKey(ctx context.Context, encoded string) (*DatastoreKey, error)
DecodeKey decodes a key string (alias for Decode)
func FromDBKey ¶
func FromDBKey(key db.Key) *DatastoreKey
FromDBKey converts a db.Key to a DatastoreKey
func New ¶
func New(ctx context.Context, kind string, id interface{}, parent Key) *DatastoreKey
New creates a new key for given id type
func NewFromId ¶
func NewFromId(ctx context.Context, id string) *DatastoreKey
NewFromId returns key from hashid or encoded strings
func NewFromInt ¶
func NewFromInt(ctx context.Context, kind string, intid interface{}, parent Key) (*DatastoreKey, error)
NewFromInt returns key from integer id
func NewIncompleteKey ¶
func NewIncompleteKey(ctx context.Context, kind string, parent Key) *DatastoreKey
NewIncompleteKey creates a new incomplete key
func ToDatastoreKey ¶
func ToDatastoreKey(key Key) *DatastoreKey
ToDatastoreKey converts any Key to a DatastoreKey
func (*DatastoreKey) AppID ¶
func (k *DatastoreKey) AppID() string
func (*DatastoreKey) Encode ¶
func (k *DatastoreKey) Encode() string
func (*DatastoreKey) Equal ¶
func (k *DatastoreKey) Equal(o Key) bool
func (*DatastoreKey) GobDecode ¶
func (k *DatastoreKey) GobDecode(buf []byte) error
func (*DatastoreKey) GobEncode ¶
func (k *DatastoreKey) GobEncode() ([]byte, error)
func (*DatastoreKey) Incomplete ¶
func (k *DatastoreKey) Incomplete() bool
func (*DatastoreKey) IntID ¶
func (k *DatastoreKey) IntID() int64
func (*DatastoreKey) Kind ¶
func (k *DatastoreKey) Kind() string
func (*DatastoreKey) MarshalJSON ¶
func (k *DatastoreKey) MarshalJSON() ([]byte, error)
func (*DatastoreKey) Namespace ¶
func (k *DatastoreKey) Namespace() string
func (*DatastoreKey) Parent ¶
func (k *DatastoreKey) Parent() Key
func (*DatastoreKey) SetIntID ¶
func (k *DatastoreKey) SetIntID(id int64)
SetIntID sets the integer ID on the key
func (*DatastoreKey) SetNamespace ¶
func (k *DatastoreKey) SetNamespace(ns string)
SetNamespace sets the namespace on the key
func (*DatastoreKey) SetStringID ¶
func (k *DatastoreKey) SetStringID(id string)
SetStringID sets the string ID on the key
func (*DatastoreKey) String ¶
func (k *DatastoreKey) String() string
func (*DatastoreKey) StringID ¶
func (k *DatastoreKey) StringID() string
func (*DatastoreKey) ToDBKey ¶
func (k *DatastoreKey) ToDBKey(database db.DB) db.Key
ToDBKey converts a DatastoreKey to a db.Key
func (*DatastoreKey) UnmarshalJSON ¶
func (k *DatastoreKey) UnmarshalJSON(buf []byte) error