Documentation

Index

Constants

This section is empty.

Variables

var StormCodec = storm.Codec(msgpack.Codec)

StormCodec is the format used to store data in the database.


Functions

func StormInit

func StormInit(database string) error

StormInit initializes Storm database.

func StormReIndex

func StormReIndex(database string) error

StormReIndex reindex Storm database.

Types

type Client

type Client interface {
	// Save inserts or updates the entry in database with the given model.
	Save(m model.Model) error
	// Close the database.
	Close() error
	// IsNotFound returns true if err is nil or a not found error.
	IsNotFound(err error) bool

	UserInteraction
	ItemInteraction
}

A Client can interacts with the database.

func StormOpen

func StormOpen(database string) (Client, error)

StormOpen returns a new Storm database connection.

type ItemInteraction

type ItemInteraction interface {
	// FindItem returns the item for the given id (UUID).
	FindItem(id string) (*model.Item, error)
	// FindItemsByParams returns all the matching records for the given parameters.
	// It also returns a boolean to true if there is more items than the given limit.
	FindItemsByParams(userID, contentType string, updated time.Time, strictTime, filterDeleted bool, limit int) ([]*model.Item, bool, error)
	// FindItemsForIntegrityCheck returns valid items for computing data signature forthe given user.
	FindItemsForIntegrityCheck(userID string) ([]*model.Item, error)
	// DeleteItem deletes the item matching the given parameters.
	DeleteItem(id, userID string) error
}

An ItemInteraction defines all the methods used to interact with a item record(s).

type UserInteraction

type UserInteraction interface {
	// FindUser returns the user for the given id (UUID).
	FindUser(id string) (*model.User, error)
	// FindUserByMail returns the user for the given email.
	FindUserByMail(email string) (*model.User, error)
}

An UserInteraction defines all the methods used to interact with a user record.