datastore

package
v0.0.5 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: 0

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