Documentation
¶
Index ¶
- type Client
- func (_c Client) BulkCreate(ctx context.Context, objs []*Obj) (objKeys []ObjKey, err error)
- func (_c Client) BulkDelete(ctx context.Context, objKeys []ObjKey) (deletedKeys []*ObjKey, err error)
- func (_c Client) BulkLoad(ctx context.Context, objKeys []ObjKey) (books []*Obj, err error)
- func (_c Client) BulkRevise(ctx context.Context, objs []*Obj) (revisedKeys []ObjKey, err error)
- func (_c Client) BulkStore(ctx context.Context, objs []*Obj) (storedKeys []ObjKey, err error)
- func (_c Client) Count(ctx context.Context, query Query) (count int, err error)
- func (_c Client) Create(ctx context.Context, obj *Obj) (objKey ObjKey, err error)
- func (_c Client) Delete(ctx context.Context, objKey ObjKey) (deleted bool, err error)
- func (_c Client) List(ctx context.Context, query Query) (objs []*Obj, totalCount int, err error)
- func (_c Client) Load(ctx context.Context, objKey ObjKey) (obj *Obj, found bool, err error)
- func (_c Client) Lookup(ctx context.Context, query Query) (obj *Obj, found bool, err error)
- func (_c Client) MustDelete(ctx context.Context, objKey ObjKey) (err error)
- func (_c Client) MustLoad(ctx context.Context, objKey ObjKey) (obj *Obj, err error)
- func (_c Client) MustLookup(ctx context.Context, query Query) (obj *Obj, err error)
- func (_c Client) MustRevise(ctx context.Context, obj *Obj) (err error)
- func (_c Client) MustStore(ctx context.Context, obj *Obj) (err error)
- func (_c Client) Purge(ctx context.Context, query Query) (deletedKeys []*ObjKey, err error)
- func (_c Client) Revise(ctx context.Context, obj *Obj) (revised bool, err error)
- func (_c Client) Store(ctx context.Context, obj *Obj) (stored bool, err error)
- type Obj
- type ObjKey
- type Query
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
}
Client is a stub.
func (Client) BulkCreate ¶
func (Client) BulkDelete ¶
func (Client) BulkRevise ¶
func (Client) MustDelete ¶
func (Client) MustLookup ¶
type Obj ¶
type Obj struct {
Key ObjKey `json:"key,omitzero"`
Revision int `json:"revision,omitzero"`
CreatedAt time.Time `json:"createdAt,omitzero"`
UpdatedAt time.Time `json:"updatedAt,omitzero"`
// HINT: Define the fields of the object here
Example string `json:"example,omitzero" jsonschema:"-"` // Do not remove the example
}
Obj
type ObjKey ¶
type ObjKey struct {
ID int `json:"id,omitempty"`
}
ObjKey is the ID of the object.
func ParseKey ¶
ParseKey returns a key from its scrambled (string) or unscrambled (int) ID. A zero key is returned if the ID can't be parsed.
func (ObjKey) MarshalJSON ¶
MarshalJSON overrides JSON serialization to encrypt the ID.
func (*ObjKey) UnmarshalJSON ¶
UnmarshalJSON overrides JSON deserialization to decrypt the ID.
type Query ¶
type Query struct {
Key ObjKey `json:"key,omitzero"`
Keys []ObjKey `json:"keys,omitzero"`
Q string `json:"q,omitzero"`
Select string `json:"select,omitzero"`
OrderBy string `json:"orderBy,omitzero"`
Limit int `json:"limit,omitzero"`
Offset int `json:"offset,omitzero"`
// HINT: Add additional filtering options here
Example string `json:"example,omitzero"` // Do not remove the example
}
Query is used to select a subset of records using filtering options.
Select is an optional comma-separated subset of fields to include in the result. For example, "column_one,column_two". If not specified, all fields are included by default.
OrderBy is a comma-separated subset of fields to order the results by. A hyphen before the field name denotes a descending order. For example, "-column_one,column_two". If not specified, the default sort order is by "id".