datastore

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

type Datastore interface {
	GetResources(context.Context, model.Filter) ([]*model.Resource, error)
	WriteResources(context.Context, []*model.Resource) error
	Stats(context.Context) (model.Stats, error)
}

Datastore provides an interface to read/write/update to a store

func NewDatastore

func NewDatastore(ctx context.Context, cfg config.Config) (Datastore, error)

type MemoryStore

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

MemoryStore stores the last resources written in memory and return it without any filtering Not for production use!

func NewMemoryStore

func NewMemoryStore(ctx context.Context, cfg config.Config) *MemoryStore

func (*MemoryStore) GetResources

func (m *MemoryStore) GetResources(ctx context.Context, filter model.Filter) ([]*model.Resource, error)

func (*MemoryStore) Stats added in v0.0.3

func (m *MemoryStore) Stats(context.Context) (model.Stats, error)

func (*MemoryStore) WriteResources

func (m *MemoryStore) WriteResources(ctx context.Context, resources []*model.Resource) error

type SQLiteStore

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

func NewSQLiteStore

func NewSQLiteStore(ctx context.Context, cfg config.Config) (*SQLiteStore, error)

func (*SQLiteStore) GetResources

func (s *SQLiteStore) GetResources(ctx context.Context, filter model.Filter) ([]*model.Resource, error)

func (*SQLiteStore) Stats added in v0.0.3

func (s *SQLiteStore) Stats(context.Context) (model.Stats, error)

func (*SQLiteStore) WriteResources

func (s *SQLiteStore) WriteResources(ctx context.Context, resources []*model.Resource) error

Jump to

Keyboard shortcuts

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