key

package
v1.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FromId = Decode
)

Functions

func Encode

func Encode(ctx context.Context, key Key) string

Encode key using hashid algorithm

func Encode64

func Encode64(key Key) string

Encode64 encodes key with base64 encoding

func Exists

func Exists(ctx context.Context, key interface{}) (bool, error)

Exists checks if key exists in datastore

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 NewKey

func NewKey(ctx context.Context, kind, stringID string, intID int64, parent Key) *DatastoreKey

NewKey creates a new key with the specified parameters

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

type Key

type Key = iface.Key

Key is a type alias for iface.Key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL