driver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMultipleFound = errors.New("multiple found where should be one")

ErrMultipleFound is returned when the result set from the database holds more than one error, inside a call that requires exactly one.

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when the result set from the database held 0 records

Functions

This section is empty.

Types

type CodeList

type CodeList interface {
	GetCodeLists(ctx context.Context, filterBy string) (*codelistModels.CodeListResults, error)
	GetCodeList(ctx context.Context, codeListID string) (*codelistModels.CodeList, error)
	GetEditions(ctx context.Context, codeListID string) (*codelistModels.Editions, error)
	GetEdition(ctx context.Context, codeListID, edition string) (*codelistModels.Edition, error)
	GetCodes(ctx context.Context, codeListID, edition string) (*codelistModels.CodeResults, error)
	GetCode(ctx context.Context, codeListID, edition string, code string) (*codelistModels.Code, error)
	GetCodeDatasets(ctx context.Context, codeListID, edition string, code string) (*codelistModels.Datasets, error)
}

CodeList defines functions to retrieve code list and code nodes

type Dimension

type Dimension interface {
	InsertDimension(ctx context.Context, cache map[string]string, i *importModels.Instance, d *importModels.Dimension) (*importModels.Dimension, error)
}

Dimension defines functions to create dimension nodes

type Driver

type Driver interface {
	Close(ctx context.Context) error
	Healthcheck() (string, error)
}

Driver is the base interface any driver implementation must satisfy

type ErrAttemptsExceededLimit

type ErrAttemptsExceededLimit struct {
	WrappedErr error
}

ErrAttemptsExceededLimit is returned when the number of attempts has reaced the maximum permitted

func (ErrAttemptsExceededLimit) Error

func (e ErrAttemptsExceededLimit) Error() string

type ErrNonRetriable

type ErrNonRetriable struct {
	WrappedErr error
}

ErrNonRetriable is returned when the wrapped error type is not retriable

func (ErrNonRetriable) Error

func (e ErrNonRetriable) Error() string

type Hierarchy

type Hierarchy interface {
	CreateInstanceHierarchyConstraints(ctx context.Context, attempt int, instanceID, dimensionName string) error
	CloneNodes(ctx context.Context, attempt int, instanceID, codeListID, dimensionName string) error
	CountNodes(ctx context.Context, instanceID, dimensionName string) (count int64, err error)
	CloneRelationships(ctx context.Context, attempt int, instanceID, codeListID, dimensionName string) error
	SetNumberOfChildren(ctx context.Context, attempt int, instanceID, dimensionName string) error
	SetHasData(ctx context.Context, attempt int, instanceID, dimensionName string) error
	MarkNodesToRemain(ctx context.Context, attempt int, instanceID, dimensionName string) error
	RemoveNodesNotMarkedToRemain(ctx context.Context, attempt int, instanceID, dimensionName string) error
	RemoveRemainMarker(ctx context.Context, attempt int, instanceID, dimensionName string) error

	GetHierarchyCodelist(ctx context.Context, instanceID, dimension string) (string, error)
	GetHierarchyRoot(ctx context.Context, instanceID, dimension string) (*hierarchyModels.Response, error)
	GetHierarchyElement(ctx context.Context, instanceID, dimension, code string) (*hierarchyModels.Response, error)
}

Hierarchy defines functions to create and retrieve generic and instance hierarchy nodes

type Instance

type Instance interface {
	CreateInstanceConstraint(ctx context.Context, i *importModels.Instance) error
	CreateInstance(ctx context.Context, i *importModels.Instance) error
	AddDimensions(ctx context.Context, i *importModels.Instance) error
	CreateCodeRelationship(ctx context.Context, i *importModels.Instance, codeListID, code string) error
	InstanceExists(ctx context.Context, i *importModels.Instance) (bool, error)
	CountInsertedObservations(ctx context.Context, instanceID string) (count int64, err error)
	AddVersionDetailsToInstance(ctx context.Context, instanceID string, datasetID string, edition string, version int) error
	SetInstanceIsPublished(ctx context.Context, instanceID string) error
}

Instance defines functions to create, update and retrieve details about instances

type Observation

type Observation interface {
	// StreamCSVRows returns a reader which the caller is ultimately responsible for closing
	// This allows for large volumes of data to be read from a stream without signnificant
	// memory overhead.
	StreamCSVRows(ctx context.Context, filter *observation.Filter, limit *int) (observation.StreamRowReader, error)
	InsertObservationBatch(ctx context.Context, attempt int, instanceID string, observations []*obsModels.Observation, dimensionIDs map[string]string) error
}

Observation defines functions to create and retrieve observation nodes

Jump to

Keyboard shortcuts

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