store

package
v0.0.0-...-34e3095 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

type FileStore struct {
	MemoryStore
	// contains filtered or unexported fields
}

func NewFileStore

func NewFileStore(path string, noInit bool) *FileStore

func (*FileStore) Close

func (ms *FileStore) Close(context.Context) error

func (*FileStore) Open

func (ms *FileStore) Open(context.Context) error

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) All

func (ms *MemoryStore) All(ctx context.Context) (map[string]*Record, error)

func (*MemoryStore) Close

func (ms *MemoryStore) Close(context.Context) error

func (*MemoryStore) Get

func (ms *MemoryStore) Get(ctx context.Context, id string) (*Record, error)

func (*MemoryStore) Open

func (ms *MemoryStore) Open(context.Context) error

func (*MemoryStore) Save

func (ms *MemoryStore) Save(ctx context.Context, r *Record) error

type MongoStore

type MongoStore struct {
	// contains filtered or unexported fields
}

func NewMongoStore

func NewMongoStore(uri, database, collection string) (*MongoStore, error)

func (*MongoStore) All

func (ms *MongoStore) All(ctx context.Context) (map[string]*Record, error)

func (*MongoStore) Close

func (ms *MongoStore) Close(context.Context) error

func (*MongoStore) Get

func (ms *MongoStore) Get(ctx context.Context, id string) (*Record, error)

func (*MongoStore) Open

func (ms *MongoStore) Open(context.Context) error

func (*MongoStore) Save

func (ms *MongoStore) Save(ctx context.Context, r *Record) error

type Record

type Record struct {
	ID           string            `json:"_id,omitempty"`
	Name         string            `json:"name,omitempty"`
	Version      string            `json:"version,omitempty"`
	Dependencies map[string]string `json:"dependencies,omitempty"`
}

type Records

type Records map[string]*Record

type Store

type Store interface {
	Save(context.Context, *Record) error
	Get(context.Context, string) (*Record, error)
	All(context.Context) (map[string]*Record, error)

	Open(context.Context) error
	Close(context.Context) error
}

Jump to

Keyboard shortcuts

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