Documentation ¶
Index ¶
- func Between(k, v1, v2 string) query
- func Eq(k, v string) query
- func In(k, v string) query
- func Limit(limit int) query
- func Neq(k, v string) query
- func Nnull(k string) query
- func None() query
- func Null(k string) query
- func Offset(offset int) query
- func Search(str string) query
- func SortAsc(sortBy string) query
- func SortDesc(sortBy string) query
- type API
- func (d API[R, W, PK]) Create(ctx context.Context, partials map[string]any) (R, error)
- func (d API[R, W, PK]) CreateToken(ctx context.Context, email, password string) (string, error)
- func (d API[R, W, PK]) Delete(ctx context.Context, id PK) error
- func (d API[R, W, PK]) GetByID(ctx context.Context, id PK) (R, error)
- func (d API[R, W, PK]) Insert(ctx context.Context, item W) (R, error)
- func (d API[R, W, PK]) Items(ctx context.Context, q query) ([]R, error)
- func (d API[R, W, PK]) Set(ctx context.Context, id PK, item W) (R, error)
- func (d API[R, W, PK]) Update(ctx context.Context, id PK, partials map[string]any) (R, error)
- type Optional
- type PrimaryKey
- type Time
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API[R, W any, PK PrimaryKey] struct { Scheme string Host string Namespace string CollectionName string BearerToken string HTTPClient *http.Client Version Version // contains filtered or unexported fields }
API is a generic API client for any Directus collection R is a read model W is a write model PK is a type of primary key
func (API[R, W, PK]) Create ¶
Create attempts to create new item with partials
Related Directus reference: https://v8.docs.directus.io/api/items.html#create-an-item
func (API[R, W, PK]) CreateToken ¶
CreateToken uses provided credentials to generate server token
Related Directus reference: https://v8.docs.directus.io/api/authentication.html#retrieve-a-temporary-access-token
func (API[R, W, PK]) Delete ¶
Delete removes item with a given id
Related Directus reference: https://v8.docs.directus.io/api/items.html#update-an-item
func (API[R, W, PK]) GetByID ¶
GetByID reads a single item by given ID
Related Directus reference: https://v8.docs.directus.io/api/items.html#retrieve-an-item
func (API[R, W, PK]) Insert ¶
Insert attempts to insert new item
Related Directus reference: https://v8.docs.directus.io/api/items.html#create-an-item
func (API[R, W, PK]) Items ¶
Items retrieves a collection of items
Related Directus reference: https://v8.docs.directus.io/api/items.html#update-an-item
func (API[R, W, PK]) Set ¶
Set performs an update of an item with given id
Related Directus reference: https://v8.docs.directus.io/api/items.html#update-an-item
type Optional ¶
type Optional[T any] struct { // contains filtered or unexported fields }
func SetOptional ¶
func UnsetOptional ¶
func (Optional[T]) MarshalJSON ¶
func (*Optional[T]) UnmarshalJSON ¶
func (Optional[T]) ValueOrZero ¶
func (o Optional[T]) ValueOrZero() T