Documentation ¶
Index ¶
- type Repo
- func (r *Repo[T]) Count(ctx context.Context, query *datastore.Query) (int, error)
- func (r *Repo[T]) Delete(ctx context.Context, key string) error
- func (r *Repo[T]) Get(ctx context.Context, key string) (*T, error)
- func (r *Repo[T]) Insert(ctx context.Context, key string, entity *T) (duplicate bool, err error)
- func (r *Repo[T]) NewQuery() *datastore.Query
- func (r *Repo[T]) Query(ctx context.Context, query *datastore.Query) ([]*T, error)
- func (r *Repo[T]) Upsert(ctx context.Context, key string, entity *T) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repo ¶ added in v1.9.0
type Repo[T any] struct { // contains filtered or unexported fields }
Repo exposes read and write operations to Google Cloud Datastore.
func (*Repo[T]) Count ¶ added in v1.9.0
Count returns the total count of items resulting from a given query.
func (*Repo[T]) Get ¶ added in v1.9.0
Get loads the single entity which matches the kind and key of the given object. The function will return nil if the entity cannot be found or an error has occurred.
func (*Repo[T]) Insert ¶ added in v1.9.0
Insert creates a new entity in GCP Datastore or fails with an error. The entity should be a struct pointer.
func (*Repo[T]) NewQuery ¶ added in v1.9.0
NewQuery creates a new *datastore.Query for the current kind.
Click to show internal directories.
Click to hide internal directories.