datastoreutil

package
v0.0.0-...-5ccd8dd Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewValidator

func NewValidator(ds Datastore) models.Datastore

NewValidator returns a models.Datastore which validates certain arguments before delegating to ds.

Types

type Datastore

type Datastore interface {
	// name will never be empty.
	GetApp(ctx context.Context, name string) (*models.App, error)

	GetApps(ctx context.Context, appFilter *models.AppFilter) ([]*models.App, error)

	// app and app.Name will never be nil/empty.
	InsertApp(ctx context.Context, app *models.App) (*models.App, error)
	UpdateApp(ctx context.Context, app *models.App) (*models.App, error)

	// name will never be empty.
	RemoveApp(ctx context.Context, name string) error

	// appName and routePath will never be empty.
	GetRoute(ctx context.Context, appName, routePath string) (*models.Route, error)
	RemoveRoute(ctx context.Context, appName, routePath string) error

	GetRoutes(ctx context.Context, filter *models.RouteFilter) (routes []*models.Route, err error)

	// appName will never be empty
	GetRoutesByApp(ctx context.Context, appName string, filter *models.RouteFilter) (routes []*models.Route, err error)

	// route will never be nil and route's AppName and Path will never be empty.
	InsertRoute(ctx context.Context, route *models.Route) (*models.Route, error)
	UpdateRoute(ctx context.Context, route *models.Route) (*models.Route, error)

	// key will never be nil/empty
	Put(ctx context.Context, key, val []byte) error
	Get(ctx context.Context, key []byte) ([]byte, error)
}

Datastore is a copy of models.Datastore, with additional comments on parameter guarantees.

Jump to

Keyboard shortcuts

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