Documentation
¶
Overview ¶
Package fake provides a fake implementation of a Datastore client to use in testing.
Index ¶
- type Client
- func (f *Client) AllocateIDs(context.Context, []*datastore.Key) ([]*datastore.Key, error)
- func (f *Client) Close() error
- func (f *Client) Count(context.Context, *datastore.Query) (n int, err error)
- func (f *Client) Delete(context.Context, *datastore.Key) error
- func (f *Client) DeleteMulti(context.Context, []*datastore.Key) (err error)
- func (f *Client) Get(_ context.Context, key *datastore.Key, dst any) (err error)
- func (f *Client) GetAll(_ context.Context, q *datastore.Query, dst any) (keys []*datastore.Key, err error)
- func (f *Client) GetMulti(context.Context, []*datastore.Key, any) (err error)
- func (f *Client) Mutate(context.Context, ...*datastore.Mutation) (ret []*datastore.Key, err error)
- func (f *Client) NewTransaction(context.Context, ...datastore.TransactionOption) (t dsiface.Transaction, err error)
- func (f *Client) Put(_ context.Context, key *datastore.Key, src any) (*datastore.Key, error)
- func (f *Client) PutMulti(context.Context, []*datastore.Key, any) (ret []*datastore.Key, err error)
- func (f *Client) Run(context.Context, *datastore.Query) dsiface.Iterator
- func (f *Client) RunInTransaction(context.Context, func(tx dsiface.Transaction) error, ...) (cmt dsiface.Commit, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a fake implementation of dsiface.Client to use in testing.
func (*Client) AllocateIDs ¶
AllocateIDs is unimplemented and panics.
func (*Client) DeleteMulti ¶
DeleteMulti is unimplemented and panics.
func (*Client) GetAll ¶
func (f *Client) GetAll(_ context.Context, q *datastore.Query, dst any) (keys []*datastore.Key, err error)
GetAll runs the provided query in the given context and returns all keys that match that query, as well as appending the values to dst.
GetAll currently only supports a query of all entities of a given Kind, and a dst of a slice of pointers to structs.
func (*Client) NewTransaction ¶
func (f *Client) NewTransaction(context.Context, ...datastore.TransactionOption) (t dsiface.Transaction, err error)
NewTransaction is unimplemented and panics.
func (*Client) Put ¶
Put saves the entity src into the datastore with the given key. src must be a struct pointer.
func (*Client) RunInTransaction ¶
func (f *Client) RunInTransaction(context.Context, func(tx dsiface.Transaction) error, ...datastore.TransactionOption) (cmt dsiface.Commit, err error)
RunInTransaction is unimplemented and panics.