types

package
v0.0.0-...-98fda95 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DSKeyConverter

type DSKeyConverter interface {
	ToDSKey(ctx ae.Context) *ds.Key
}

DSKeyConverter can return a datastore.Key.

type Filter

type Filter struct {
	Filter string
	Value  interface{}
}

Filter is a conditional filter on query results.

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

Iterator is the result of running a query.

func NewIterator

func NewIterator(ctx ae.Context, query *Query) *Iterator

NewIterator returns a new Iterator by executing the passed-in query.

func (*Iterator) Cursor

func (it *Iterator) Cursor() (string, error)

Cursor returns a cursor for the Iterator's current location.

func (*Iterator) Next

func (it *Iterator) Next(pipeFunc func(ae.Context) ds.PropertyLoadSaver) (*ds.Key, error)

Next returns the key of the next result. If the query is not keys-only, it also loads the entity stored for that key into a PropertyLoadSaver.

type Key

type Key struct {
	*KeyState

	Kind      string
	Namespace string

	StringID string
	IntID    int64

	Parent *Key
}

Key represents the identifier for an entity.

func GetEntitiesKeys

func GetEntitiesKeys(kind *Kind, src interface{}) ([]*Key, error)

GetEntitiesKeys extracts a sequence of Key from the given entities.

func GetEntityKey

func GetEntityKey(kind *Kind, src interface{}) (*Key, error)

GetEntityKey extracts a new Key from the given entity.

func ImportKey

func ImportKey(dsKey *ds.Key) *Key

ImportKey creates a Key from a datastore.Key.

func ImportKeys

func ImportKeys(keys ...*ds.Key) []*Key

ImportKeys creates a sequence of Key from a sequence of datastore.Key.

func NewKey

func NewKey(kind, stringID string, intID int64, parent *Key) *Key

NewKey returns a new Key.

func (*Key) Incomplete

func (k *Key) Incomplete() bool

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.

func (*Key) String

func (k *Key) String() string

func (*Key) ToDSKey

func (k *Key) ToDSKey(ctx ae.Context) *ds.Key

ToDSKey converts the key to a datastore Key.

type KeyState

type KeyState struct {

	// Synced is the last time the entity was read/written.
	Synced *time.Time

	// Error contains an error if the key could not be loaded/saved.
	Error error
}

KeyState represents meta data of the datastore operation the key originates from, if any.

type Kind

type Kind struct {
	Context ae.Context
	Name    string
}

Kind represents a kind of entity in the datastore.

func NewKind

func NewKind(ctx ae.Context, name string) *Kind

NewKind creates a new kind.

type Opts

type Opts struct {

	// CompleteKeys is whether an entity's key must be set before writing.
	CompleteKeys bool

	// NoGlobalCache is whether memcache is used.
	NoGlobalCache bool
}

Opts represents options that change the behaviour of datastore operations.

func DefaultOpts

func DefaultOpts() *Opts

DefaultOpts returns an object with default options.

func (*Opts) Clone

func (opts *Opts) Clone() *Opts

Clone returns a deep copy.

type Order

type Order struct {
	FieldName  string
	Descending bool
}

Order is a sort order on query results.

type Query

type Query struct {
	Ancestor   *Key
	Filter     []Filter
	Order      []Order
	Projection []string

	TypeOf   QueryType
	Distinct bool
	Eventual bool
	Limit    int
	Offset   int
	Start    string
	End      string
	// contains filtered or unexported fields
}

Query represents a datastore query.

func NewQuery

func NewQuery(kind string) (ret *Query)

NewQuery creates a new, empty query.

func (*Query) Clone

func (q *Query) Clone() *Query

Clone creates a deep copy.

func (*Query) ToDSQuery

func (q *Query) ToDSQuery(ctx ae.Context) *ds.Query

ToDSQuery converts the query to a datastore Query.

type QueryType

type QueryType int

QueryType describes the way a query is run and what it returns.

const (
	// FullQuery is a regular query.
	FullQuery QueryType = 1 + iota

	// ProjectQuery is a query that only yields selected fields.
	ProjectQuery

	// KeysOnlyQuery is a query that only returns the result's keys.
	KeysOnlyQuery
)

Jump to

Keyboard shortcuts

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