Documentation ¶
Index ¶
- Constants
- type Document
- type DocumentRepositorier
- type DocumentRepositoryError
- type Pagination
- type Resource
- type ResourceChange
- type ResourceRepositorier
- type ResourceRepositoryError
- type Subscription
- type SubscriptionContent
- type SubscriptionDelivery
- type SubscriptionEndpoint
- type SubscriptionRepositorier
- type SubscriptionRepositoryError
- type SubscriptionTrigger
Constants ¶
const ( SubscriptionTriggerCreate = "create" SubscriptionTriggerUpdate = "update" SubscriptionTriggerDelete = "delete" )
All kinds of actions a subscription trigger has.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct { ID url.URL Revision int64 Resource Resource Content map[string]interface{} UpdatedAt time.Time }
Document represents the documents from a resource.
type DocumentRepositorier ¶
type DocumentRepositorier interface { FindByID(ctx context.Context, id url.URL) (*Document, error) Update(context.Context, *Document) error Delete(ctx context.Context, id url.URL) error }
DocumentRepositorier used to interact with document data storage.
type DocumentRepositoryError ¶
DocumentRepositoryError implements all the errrors the repository can return.
type Pagination ¶
Pagination used to fetch a slice of a given entity.
func (*Pagination) Valid ¶
func (p *Pagination) Valid() error
Valid indicates if the current pagination is valid.
type Resource ¶
Resource represents the apis Flare track and the info to detect changes on documents.
type ResourceChange ¶
ResourceChange holds the information to detect document change.
func (*ResourceChange) Valid ¶
func (rc *ResourceChange) Valid() error
Valid indicates if the current resourceChange is valid.
type ResourceRepositorier ¶
type ResourceRepositorier interface { Find(context.Context, *Pagination) ([]Resource, *Pagination, error) FindByID(context.Context, string) (*Resource, error) FindByURI(context.Context, url.URL) (*Resource, error) Partitions(ctx context.Context, id string) (partitions []string, err error) Create(context.Context, *Resource) error Delete(context.Context, string) error }
ResourceRepositorier is used to interact with Resource repository.
type ResourceRepositoryError ¶
ResourceRepositoryError represents all the errors the repository can return.
type Subscription ¶
type Subscription struct { ID string Endpoint SubscriptionEndpoint Delivery SubscriptionDelivery Resource Resource Partition string Data map[string]interface{} Content SubscriptionContent CreatedAt time.Time }
Subscription has all the information needed to notify the clients from changes on documents.
type SubscriptionContent ¶
SubscriptionContent configure the content delived by the subscription.
type SubscriptionDelivery ¶
SubscriptionDelivery is used to control whenever the notification can be considered successful or not.
type SubscriptionEndpoint ¶
type SubscriptionEndpoint struct { URL *url.URL Method string Headers http.Header Action map[string]SubscriptionEndpoint }
SubscriptionEndpoint has the address information to notify the clients.
type SubscriptionRepositorier ¶
type SubscriptionRepositorier interface { Find(context.Context, *Pagination, string) ([]Subscription, *Pagination, error) FindByID(ctx context.Context, resourceID, id string) (*Subscription, error) FindByPartition( ctx context.Context, resourceID, partition string, ) (<-chan Subscription, <-chan error, error) Create(context.Context, *Subscription) error Delete(ctx context.Context, resourceID, id string) error Trigger( ctx context.Context, action string, document *Document, subscription *Subscription, fn func(context.Context, *Document, *Subscription, string) error, ) error }
SubscriptionRepositorier is used to interact with the subscription data storage.
type SubscriptionRepositoryError ¶
SubscriptionRepositoryError represents all the errors the repository can return.