Documentation ¶
Index ¶
- func ReadResourceKey[V any](data []byte, err error) ([]V, error)
- func ReadStream[K any, V any](callback func(event StreamType, data []CollectionValue[K, V]) error) func(event StreamType, data []byte) error
- func Values[T any](v ...T) []skipValue
- type CollectionData
- type CollectionValue
- type ControlClient
- type StreamClient
- type StreamType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadResourceKey ¶ added in v0.0.7
ReadResourceKey takes raw resource key data and unmarshals it with the given type.
func ReadStream ¶ added in v0.0.7
func ReadStream[K any, V any](callback func(event StreamType, data []CollectionValue[K, V]) error) func(event StreamType, data []byte) error
Types ¶
type CollectionData ¶ added in v0.0.7
type CollectionData struct { Key interface{} Values []skipValue }
CollectionData represents a untyped set of collection values. This is used when posting new data to a collection.
func (*CollectionData) MarshalJSON ¶ added in v0.0.7
func (u *CollectionData) MarshalJSON() ([]byte, error)
func (*CollectionData) UnmarshalJSON ¶ added in v0.0.7
func (u *CollectionData) UnmarshalJSON(data []byte) error
type CollectionValue ¶ added in v0.0.7
CollectionValue is a typed set of collection values. This is used when reading data from a collection.
func ReadResourceSnapshot ¶ added in v0.0.7
ReadResourceSnapshot takes raw resource snapshot data and unmarshals it with the given types.
func (*CollectionValue[K, V]) UnmarshalJSON ¶ added in v0.0.7
func (c *CollectionValue[K, V]) UnmarshalJSON(data []byte) error
type ControlClient ¶
type ControlClient interface { // GetSnapshot retrieves a snapshot of the entire resource. // Corresponds to the POST /v1/snapshot/:resource endpoint. GetResourceSnapshot(ctx context.Context, resource string, params interface{}) ([]byte, error) // GetResourceKey retrieves the data associated with a specific key in a resource. // Corresponds to the POST /v1/snapshot/:resource/lookup endpoint. GetResourceKey(ctx context.Context, resource string, key interface{}, params interface{}) ([]byte, error) // UpdateInputCollection updates a collection of key-value pairs in the specified input collection. // Corresponds to the PATCH /v1/inputs/:collection endpoint. UpdateInputCollection(ctx context.Context, collection string, updates []CollectionData) error // CreateResourceInstance creates a new resource instance and returns its UUID. // Corresponds to the POST /v1/streams/:resource endpoint. CreateResourceInstance(ctx context.Context, resource string, params interface{}) (string, error) // DeleteResourceInstance deletes a resource instance by its UUID. // Corresponds to the DELETE /v1/streams/:uuid endpoint. DeleteResourceInstance(ctx context.Context, uuid string) error }
ControlClient defines access to Skip's Control API.
func NewControlClient ¶
func NewControlClient(baseURL string) ControlClient
NewControlClient creates a new instance of ControlClient.
type StreamClient ¶
type StreamClient interface { // Stream is a live data stream for a resource instance represented by the UUID. // Corresponds to the GET /v1/streams/:uuid endpoint. Stream(ctx context.Context, uuid string, callback func(event StreamType, data []byte) error) error }
StreamClient defines access to Skip's Stream API.
func NewStreamClient ¶ added in v0.0.7
func NewStreamClient(baseURL string) StreamClient
NewStreamClient creates a new instance of StreamClient.
type StreamType ¶
type StreamType string
const ( InitStreamType StreamType = "init" UpdateStreamType StreamType = "update" )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.