database

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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)
	// FindItemByUserID returns the item for the given id and user id (UUID).
	FindItemByUserID(id, userID 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.

Jump to

Keyboard shortcuts

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