Documentation ¶
Index ¶
- Variables
- type Backup
- func (b Backup) Create(key ...string) error
- func (b Backup) Delete(key string) error
- func (b Backup) FullList() ([]ResponseBackupFullList, error)
- func (b Backup) GetDownloadURL(token string, key string) (string, error)
- func (b Backup) Restore(key string) error
- func (b Backup) Upload(key string, reader io.Reader) error
- type Client
- func (c *Client) AuthStore() authStore
- func (c *Client) Authorize() error
- func (c *Client) Backup() Backup
- func (c *Client) Create(collection string, body any) (ResponseCreate, error)
- func (c *Client) Delete(collection string, id string) error
- func (c *Client) Files() Files
- func (c *Client) FullList(collection string, params ParamsList) (ResponseList[map[string]any], error)
- func (c *Client) List(collection string, params ParamsList) (ResponseList[map[string]any], error)
- func (c *Client) Update(collection string, id string, body any) error
- type ClientOption
- func WithAdminEmailPassword(email, password string) ClientOption
- func WithAdminToken(token string) ClientOption
- func WithDebug() ClientOption
- func WithUserEmailPassword(email, password string) ClientOption
- func WithUserEmailPasswordAndCollection(email, password, collection string) ClientOption
- func WithUserToken(token string) ClientOption
- type Collection
- func (c Collection[T]) Create(body T) (ResponseCreate, error)
- func (c Collection[T]) Delete(id string) error
- func (c Collection[T]) FullList(params ParamsList) (ResponseList[T], error)
- func (c Collection[T]) List(params ParamsList) (ResponseList[T], error)
- func (c Collection[T]) One(id string) (T, error)
- func (c Collection[T]) OneWithParams(id string, params ParamsList) (T, error)
- func (c Collection[T]) Subscribe(targets ...string) (*Stream[T], error)
- func (c Collection[T]) SubscribeWith(opts SubscribeOptions, targets ...string) (*Stream[T], error)
- func (c Collection[T]) Update(id string, body T) error
- type CreateRequest
- type Event
- type Files
- type ParamsList
- type ResponseBackupFullList
- type ResponseCreate
- type ResponseGetToken
- type ResponseList
- type Stream
- type SubscribeOptions
- type SubscriptionsSet
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidResponse = errors.New("invalid response")
Functions ¶
This section is empty.
Types ¶
type Backup ¶
type Backup struct {
*Client
}
func (Backup) Delete ¶
Delete deletes a single backup file.
Example:
file, _ := os.Open("./backups/pb_backup.zip") defer file.Close() _ = defaultClient.Backup().Upload("mybackup.zip", file)
func (Backup) FullList ¶
func (b Backup) FullList() ([]ResponseBackupFullList, error)
FullList returns list with all available backup files.
func (Backup) GetDownloadURL ¶
GetDownloadToken builds a download url for a single existing backup using an admin file token and the backup file key.
The file token can be generated via `client.Files().GetToken()`.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(url string, opts ...ClientOption) *Client
func (*Client) Create ¶
func (c *Client) Create(collection string, body any) (ResponseCreate, error)
func (*Client) FullList ¶
func (c *Client) FullList(collection string, params ParamsList) (ResponseList[map[string]any], error)
func (*Client) List ¶
func (c *Client) List(collection string, params ParamsList) (ResponseList[map[string]any], error)
type ClientOption ¶
type ClientOption func(*Client)
func WithAdminEmailPassword ¶
func WithAdminEmailPassword(email, password string) ClientOption
func WithAdminToken ¶
func WithAdminToken(token string) ClientOption
func WithDebug ¶
func WithDebug() ClientOption
func WithUserEmailPassword ¶
func WithUserEmailPassword(email, password string) ClientOption
func WithUserEmailPasswordAndCollection ¶
func WithUserEmailPasswordAndCollection(email, password, collection string) ClientOption
func WithUserToken ¶
func WithUserToken(token string) ClientOption
type Collection ¶
func CollectionSet ¶
func CollectionSet[T any](client *Client, collection string) Collection[T]
func (Collection[T]) Create ¶
func (c Collection[T]) Create(body T) (ResponseCreate, error)
func (Collection[T]) Delete ¶
func (c Collection[T]) Delete(id string) error
func (Collection[T]) FullList ¶
func (c Collection[T]) FullList(params ParamsList) (ResponseList[T], error)
func (Collection[T]) List ¶
func (c Collection[T]) List(params ParamsList) (ResponseList[T], error)
func (Collection[T]) One ¶
func (c Collection[T]) One(id string) (T, error)
func (Collection[T]) OneWithParams ¶
func (c Collection[T]) OneWithParams(id string, params ParamsList) (T, error)
Get one record with params (only fields and expand supported)
func (Collection[T]) Subscribe ¶
func (c Collection[T]) Subscribe(targets ...string) (*Stream[T], error)
func (Collection[T]) SubscribeWith ¶
func (c Collection[T]) SubscribeWith(opts SubscribeOptions, targets ...string) (*Stream[T], error)
func (Collection[T]) Update ¶
func (c Collection[T]) Update(id string, body T) error
type CreateRequest ¶
type CreateRequest struct {
Name string `json:"name"`
}
type ParamsList ¶
type ResponseBackupFullList ¶
type ResponseCreate ¶
type ResponseGetToken ¶
type ResponseGetToken struct {
Token string `json:"token"`
}
type ResponseList ¶
type Stream ¶
type Stream[T any] struct { // contains filtered or unexported fields }
func (*Stream[T]) Unsubscribe ¶
func (s *Stream[T]) Unsubscribe()
func (*Stream[T]) WaitAuthReady
deprecated
type SubscribeOptions ¶
type SubscribeOptions struct {
ReconnectStrategy backoff.BackOff
}
type SubscriptionsSet ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.