Documentation
¶
Overview ¶
Package api provides HTTP client access to the PowerSync service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BucketRequest ¶
BucketRequest specifies a bucket to sync and the last known checkpoint.
type Client ¶
type Client interface {
SyncStream(ctx context.Context, req *SyncStreamRequest, handler LineHandler) error
GetWriteCheckpoint(ctx context.Context, clientID string) (string, error)
SetToken(token string)
}
Client provides HTTP access to the PowerSync service.
type Error ¶
Error represents an error from the PowerSync service.
func (*Error) IsPermanent ¶
func (*Error) IsTransient ¶
type LineHandler ¶
LineHandler is called for each line received from the sync stream.
type RequestedStreamSubscription ¶
type RequestedStreamSubscription struct {
Stream string `json:"stream"`
Parameters string `json:"parameters,omitempty"`
OverridePriority *int `json:"override_priority,omitempty"`
}
RequestedStreamSubscription is a request to subscribe to a stream.
type SchemaColumn ¶
type SchemaColumn struct {
Name string `json:"name"`
Type string `json:"type"` // "text", "integer", "real"
}
SchemaColumn represents a column in a PowerSync table.
type SchemaTable ¶
type SchemaTable struct {
Name string `json:"name"`
Columns []SchemaColumn `json:"columns"`
}
SchemaTable represents a table in the PowerSync schema.
type StreamSubscription ¶
type StreamSubscription struct {
IncludeDefaults bool `json:"include_defaults"`
Subscriptions []RequestedStreamSubscription `json:"subscriptions"`
}
StreamSubscription defines stream subscription preferences.
type SyncStreamRequest ¶
type SyncStreamRequest struct {
Buckets []BucketRequest `json:"buckets"`
IncludeChecksum bool `json:"include_checksum"`
RawData bool `json:"raw_data"`
BinaryData bool `json:"binary_data"`
ClientID string `json:"client_id"`
Parameters map[string]any `json:"parameters,omitempty"`
Streams *StreamSubscription `json:"streams,omitempty"`
AppMetadata json.RawMessage `json:"app_metadata,omitempty"`
}
SyncStreamRequest is the request body for the sync stream endpoint.
Click to show internal directories.
Click to hide internal directories.