service

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncParams

type SyncParams struct {
	ComputeIntegrity bool          `json:"compute_integrity"`
	Limit            int           `json:"limit"`
	SyncToken        string        `json:"sync_token"`
	CursorToken      string        `json:"cursor_token"`
	ContentType      string        `json:"content_type"` // optional, only return items of these type if present
	Items            []*model.Item `json:"items"`
}

A SyncParams is used when a client want to sync items.

type SyncService

type SyncService struct {
	User   *model.User `json:"-"`
	Params SyncParams  `json:"-"`
	// Populated during `Execute()`
	Retrieved     []*model.Item  `json:"retrieved_items"`
	Saved         []*model.Item  `json:"saved_items"`
	Unsaved       []*UnsavedItem `json:"unsaved"`
	SyncToken     string         `json:"sync_token"`
	CursorToken   string         `json:"cursor_token"`
	IntegrityHash string         `json:"integrity_hash,omitempty"`
	// contains filtered or unexported fields
}

A SyncService is a service used for syncing items.

func NewSync

func NewSync(db database.Client, user *model.User, params SyncParams) *SyncService

NewSync instantiates a new Sync service.

func (*SyncService) Execute

func (s *SyncService) Execute() error

Execute performs the synchronisation.

type UnsavedItem

type UnsavedItem struct {
	Item  *model.Item `json:"item"`
	Error errorItem   `json:"error"`
}

An UnsavedItem is an object containing an item that can't be saved.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL