Documentation ¶
Index ¶
- type Deleter
- func (d *Deleter) Entities(srcs interface{}) error
- func (d *Deleter) Entity(src interface{}) error
- func (d *Deleter) ID(id int64, parent ...*Key) error
- func (d *Deleter) IDs(ids ...int64) error
- func (d *Deleter) Key(key *Key) error
- func (d *Deleter) Keys(keys []*Key) error
- func (sa Deleter) Kind() *types.Kind
- func (d *Deleter) TextID(id string, parent ...*Key) error
- func (d *Deleter) TextIDs(ids ...string) error
- type Iterator
- type Key
- func (k *Key) Error() error
- func (k *Key) Exists() bool
- func (k *Key) Incomplete() bool
- func (k *Key) IntID() int64
- func (k *Key) Kind() string
- func (k *Key) Namespace() string
- func (k *Key) Parent() *Key
- func (k *Key) String() string
- func (k *Key) StringID() string
- func (k *Key) ToDSKey(ctx ae.Context) *ds.Key
- type Kind
- func (k *Kind) Delete(ctx ae.Context) *Deleter
- func (k *Kind) Load(ctx ae.Context) *Loader
- func (k *Kind) Name() string
- func (k *Kind) NewNumKey(id int64, parent ...*Key) *Key
- func (k *Kind) NewNumKeys(ids ...int64) []*Key
- func (k *Kind) NewTextKey(id string, parent ...*Key) *Key
- func (k *Kind) NewTextKeys(ids ...string) []*Key
- func (k *Kind) Query(ctx ae.Context) *Query
- func (k *Kind) Save(ctx ae.Context) *Saver
- type Loader
- func (l *Loader) ID(id int64, parent ...*Key) *SingleLoader
- func (l *Loader) IDs(ids ...int64) *MultiLoader
- func (l *Loader) Key(key *Key) *SingleLoader
- func (l *Loader) Keys(keys []*Key) *MultiLoader
- func (sa Loader) Kind() *types.Kind
- func (l *Loader) NoGlobalCache() *Loader
- func (l *Loader) TextID(id string, parent ...*Key) *SingleLoader
- func (l *Loader) TextIDs(ids ...string) *MultiLoader
- type MultiLoader
- type Query
- func (qry *Query) Ancestor(k *Key) (ret *Query)
- func (qry *Query) Distinct() (ret *Query)
- func (qry *Query) End(c string) (ret *Query)
- func (qry *Query) EventualConsistency() (ret *Query)
- func (qry *Query) Filter(q string, val interface{}) (ret *Query)
- func (qry *Query) GetAll(dsts interface{}) ([]*Key, string, error)
- func (qry *Query) GetCount() (int, error)
- func (qry *Query) GetFirst(dst interface{}) (*Key, error)
- func (qry *Query) GetKeys() ([]*Key, string, error)
- func (qry *Query) Limit(limit int) (ret *Query)
- func (qry *Query) NoGlobalCache() (ret *Query)
- func (qry *Query) NoLimit() (ret *Query)
- func (qry *Query) Offset(off int) (ret *Query)
- func (qry *Query) OrderAsc(s string) (ret *Query)
- func (qry *Query) OrderDesc(s string) (ret *Query)
- func (qry *Query) Project(fields ...string) (ret *Query)
- func (qry *Query) Run() *Iterator
- func (qry *Query) Start(c string) (ret *Query)
- type Saver
- type SingleLoader
- type Store
- type TX
- type Transactor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deleter ¶
type Deleter struct {
// contains filtered or unexported fields
}
Deleter can delete entities from a kind.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator is the result of running a query.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key represents the datastore key of an entity.
func (*Key) Incomplete ¶
Incomplete returns whether the key does not refer to a stored entity. In particular, whether the key has a zero StringID and a zero IntID.
type Kind ¶
type Kind struct {
// contains filtered or unexported fields
}
Kind represents a entity category in the datastore.
func (*Kind) Delete ¶
Delete returns a Deleter action object. It allows to delete entities from the datastore.
func (*Kind) Load ¶
Load returns a Loader action object. It allows to load entities from the datastore.
func (*Kind) NewNumKey ¶
NewNumKey returns a key for the passed kind and numeric ID. It can also receive an optional parent key.
func (*Kind) NewNumKeys ¶
NewNumKeys returns a sequence of key for the passed kind and sequence of numeric ID.
func (*Kind) NewTextKey ¶
NewTextKey returns a key for the passed kind and string ID. It can also receive an optional parent key.
func (*Kind) NewTextKeys ¶
NewTextKeys returns a sequence of keys for the passed kind and sequence of string ID.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader can load entities from a kind.
func (*Loader) ID ¶
func (l *Loader) ID(id int64, parent ...*Key) *SingleLoader
ID loads a single entity by id from the datastore.
func (*Loader) IDs ¶
func (l *Loader) IDs(ids ...int64) *MultiLoader
IDs load multiple keys by id from the datastore.
func (*Loader) Key ¶
func (l *Loader) Key(key *Key) *SingleLoader
Key loads a single entity by key from the datastore.
func (*Loader) Keys ¶
func (l *Loader) Keys(keys []*Key) *MultiLoader
Keys load multiple entities by key from the datastore.
func (*Loader) NoGlobalCache ¶
NoGlobalCache prevents reading/writing entities from/to memcache.
func (*Loader) TextID ¶
func (l *Loader) TextID(id string, parent ...*Key) *SingleLoader
TextID loads a single key by text id from the datastore.
func (*Loader) TextIDs ¶
func (l *Loader) TextIDs(ids ...string) *MultiLoader
TextIDs load multiple keys by text id from the datastore.
type MultiLoader ¶
type MultiLoader struct {
// contains filtered or unexported fields
}
MultiLoader is a special Loader that allows to fetch multiple entities from the datastore.
func (*MultiLoader) GetAll ¶
func (l *MultiLoader) GetAll(dsts interface{}) ([]*Key, error)
GetAll loads entities from the datastore into the passed destination.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query represents a datastore query.
func (*Query) Ancestor ¶
Ancestor returns a derivative Query with an ancestor filter. The ancestor should not be nil.
func (*Query) Distinct ¶
Distinct returns a derivative query that yields de-duplicated entities with respect to the set of projected fields. It is only used for projection queries.
func (*Query) EventualConsistency ¶
EventualConsistency returns a derivative query that returns eventually consistent results. It only has an effect on ancestor queries.
func (*Query) Filter ¶
Filter returns a derivative Query with a field-based filter. The filterStr argument must be a field name followed by optional space, followed by an operator, one of ">", "<", ">=", "<=", or "=". Fields are compared against the provided value using the operator. Multiple filters are AND'ed together.
func (*Query) GetAll ¶
GetAll runs the query and writes the entities to the passed destination.
Note that, if not manually disabled, queries for more than 1 item use a "hybrid query". This means that first a keys-only query is executed and then the keys are used to lookup the local and global cache as well as the datastore eventually. For a warm cache this usually is faster and cheaper than the regular query.
func (*Query) GetFirst ¶
GetFirst executes the query and writes the result's first entity to the passed destination.
func (*Query) GetKeys ¶
GetKeys executes the query as keys-only: No entities are retrieved, just their keys.
func (*Query) Limit ¶
Limit returns a derivative Query that has a limit on the number of results returned. A negative value means unlimited.
func (*Query) NoGlobalCache ¶
NoGlobalCache prevents reading/writing entities from/to memcache.
func (*Query) NoLimit ¶
NoLimit returns a derivative Query that has no limit on the number of results returned.
func (*Query) Offset ¶
Offset returns a derivative Query that has an offset of how many keys to skip over before returning results. A negative value is invalid.
func (*Query) OrderAsc ¶
OrderAsc returns a derivative Query with a field-based sort order, ascending. Orders are applied in the order they are added.
func (*Query) OrderDesc ¶
OrderDesc returns a derivative Query with a field-based sort order, descending. Orders are applied in the order they are added.
func (*Query) Project ¶
Project returns a derivative Query that yields only the passed fields. It cannot be used in a keys-only query.
type Saver ¶
type Saver struct {
// contains filtered or unexported fields
}
Saver can save entities to the datastore.
func (*Saver) CompleteKeys ¶
CompleteKeys prevents saving an entity with an incomplete key.
func (*Saver) Entities ¶
Entities saves the passed entities into the datastore. If an entity's key is incomplete, the returned keys will contain a unique key generated by the datastore.
type SingleLoader ¶
type SingleLoader struct {
// contains filtered or unexported fields
}
SingleLoader is a special Loader that allows to fetch exactly one entity from the datastore.
func (*SingleLoader) GetOne ¶
func (l *SingleLoader) GetOne(dst interface{}) (*Key, error)
GetOne loads an entity from the datastore into the passed destination.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store represents the App Engine datastore. Usually there should only be one per application.
func (*Store) NoGlobalCache ¶
NoGlobalCache prevents reading/writing entities from/to memcache.
func (*Store) RegisterEntity ¶
RegisterEntity prepares the passed-in struct type for the datastore. It returns an error if the type is invalid.
func (*Store) RegisterEntityMust ¶
func (s *Store) RegisterEntityMust(entity interface{})
RegisterEntityMust prepares the passed-in struct type for the datastore. It panics if the type is invalid.
type TX ¶
TX represents an App Engine Context inside a transaction. It should only be used inside a transaction.
type Transactor ¶
type Transactor struct {
// contains filtered or unexported fields
}
Transactor can run multiple datastore operations inside a transaction. By default it does not handle multiple entity groups.
func (*Transactor) Run ¶
func (tx *Transactor) Run(f func(_ TX) error) error
Run executes a function in a transaction.
func (*Transactor) XG ¶
func (tx *Transactor) XG(enable ...bool) *Transactor
XG defines whether the transaction can cross multiple entity groups. If no parameter is passed, true is assumed.