store

package
v0.0.0-...-4784c45 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectionKey

func CollectionKey(documentKey string) string

func IsCollectionKey

func IsCollectionKey(path string) bool

func IsDocumentKey

func IsDocumentKey(path string) bool

func Less

func Less(a interface{}, b interface{}) bool

func MatchesJSON

func MatchesJSON(data []byte, query Query) bool

func OrderJSON

func OrderJSON(items []CollectionItem, order Order)

Types

type Collection

type Collection interface {
	Key() string
	Items(Query, Order, Limit) ([]CollectionItem, error)
	Add(data []byte) (Document, error)
}

type CollectionItem

type CollectionItem struct {
	Key   string
	Value []byte
}

func (CollectionItem) MarshalJSON

func (i CollectionItem) MarshalJSON() ([]byte, error)

type Document

type Document interface {
	Key() string
	Get() ([]byte, error)
	Set(data []byte) error
	Update(data []byte) error
	Delete() error
}

type Encoding

type Encoding string
const (
	Json Encoding = "JSON"
)

type Limit

type Limit struct {
	Limit  int `json:"limit"`
	Offset int `json:"offset"`
}

type Operator

type Operator string
const (
	Eq Operator = "=="
	Lt Operator = "<"
	Le Operator = "<="
	Gt Operator = ">"
	Ge Operator = ">="
)

type Order

type Order struct {
	OrderBy   string `json:"orderBy"`
	Ascending bool   `json:"ascending"`
}

type Query

type Query struct {
	Field    string   `json:"field"`
	Operator Operator `json:"operator"`
	Value    string   `json:"value"`
}

type Store

type Store interface {
	Open(enc Encoding) error
	Document(key string) (Document, error)
	Collection(key string) (Collection, error)
	Close()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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