datastore

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 21 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

View Source
const (
	//limit number of resource returned
	DefaultLimit  = 25
	LimitMaxValue = 2000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

type Datastore interface {
	GetResource(context.Context, string) (*model.Resource, error)
	GetResources(context.Context, []byte) (model.ResourcesResponse, error)
	WriteResources(context.Context, model.Resources) error
	Stats(context.Context) (model.Stats, error)
	GetFields(context.Context) (model.FieldGroups, error)
	WriteEngineStatusStart(context.Context, string) error
	WriteEngineStatusEnd(context.Context, string, error) error
	GetEngineStatus(context.Context) (model.EngineStatus, error)
	Ping() error
}

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

func NewDatastore

func NewDatastore(ctx context.Context, cfg config.Config, logger *zap.Logger) (Datastore, error)

type SQLiteStore

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

func NewSQLiteStore

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

func (*SQLiteStore) GetEngineStatus added in v0.0.10

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

func (*SQLiteStore) GetFields added in v0.0.10

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

func (*SQLiteStore) GetResource added in v0.0.10

func (s *SQLiteStore) GetResource(ctx context.Context, id string) (*model.Resource, error)

func (*SQLiteStore) GetResources

func (s *SQLiteStore) GetResources(ctx context.Context, jsonQuery []byte) (model.ResourcesResponse, error)

func (*SQLiteStore) Ping added in v0.0.10

func (s *SQLiteStore) Ping() error

func (*SQLiteStore) Stats added in v0.0.3

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

func (*SQLiteStore) WriteEngineStatusEnd added in v0.0.10

func (s *SQLiteStore) WriteEngineStatusEnd(ctx context.Context, resource string, err error) error

func (*SQLiteStore) WriteEngineStatusStart added in v0.0.10

func (s *SQLiteStore) WriteEngineStatusStart(ctx context.Context, resource string) error

func (*SQLiteStore) WriteResources

func (s *SQLiteStore) WriteResources(ctx context.Context, resources model.Resources) error

Jump to

Keyboard shortcuts

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