Documentation
¶
Index ¶
- Variables
- func New(ctx context.Context, kind string) iface.Query
- func NewWithDB(ctx context.Context, kind string, database db.DB) iface.Query
- func SetDefaultDB(database db.DB)
- type Id
- type Kind
- type Model
- type Query
- func (q *Query) Ancestor(ancestor iface.Key) iface.Query
- func (q *Query) ById(id string, dst interface{}) (iface.Key, bool, error)
- func (q *Query) ByKey(k iface.Key, dst interface{}) (iface.Key, bool, error)
- func (q *Query) Count() (int, error)
- func (q *Query) Distinct() iface.Query
- func (q *Query) End(c iface.Cursor) iface.Query
- func (q *Query) EventualConsistency() iface.Query
- func (q *Query) Filter(filterStr string, value interface{}) iface.Query
- func (q *Query) First(dst interface{}) (iface.Key, bool, error)
- func (q *Query) FirstKey() (iface.Key, bool, error)
- func (q *Query) GetAll(dst interface{}) ([]iface.Key, error)
- func (q *Query) GetKeys() ([]iface.Key, error)
- func (q *Query) GetModels(dst interface{}) error
- func (q *Query) IdExists(id string) (iface.Key, bool, error)
- func (q *Query) KeyExists(k iface.Key) (bool, error)
- func (q *Query) KeysOnly() iface.Query
- func (q *Query) Limit(limit int) iface.Query
- func (q *Query) Offset(offset int) iface.Query
- func (q *Query) Order(fieldName string) iface.Query
- func (q *Query) Project(fieldNames ...string) iface.Query
- func (q *Query) Run() iface.Iterator
- func (q *Query) Start(c iface.Cursor) iface.Query
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Done signals end of iteration Done = errors.New("datastore: done") // Custom Errors - these are package-local to avoid conflicts with dot-imported utils InvalidKey = db.ErrInvalidKey KeyNotFound = db.ErrNoSuchEntity )
Functions ¶
func New ¶
New creates a new Query for the given kind. Uses the default database if one was set via SetDefaultDB.
func SetDefaultDB ¶
SetDefaultDB sets the global default database used by New().
Types ¶
type Model ¶
type Model interface {
SetContext(ctx context.Context)
SetEntity(entity interface{})
SetKey(key interface{}) error
}
Subset of model API needed to initialize a model correctly.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query implements iface.Query using the new db package
func (*Query) EventualConsistency ¶
func (*Query) GetAll ¶
Fetches entities. Dst must have type *[]S or *[]*S or *[]P, for some struct type S or some non- interface, non-pointer type P such that P or *P implements PropertyLoadSaver.
func (*Query) GetModels ¶
Fetches models and initializes them automatically. Dst must have type *[]*M, for some model type M.
func (*Query) IdExists ¶
Returns true if entity with key that encodes to id is persisted to datastore
Click to show internal directories.
Click to hide internal directories.