Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when the result set from the database held 0 records
var ErrNotImplemented = errors.New("method not implemented by driver")
ErrNotImplemented is returned when a method is called but the driver does not implement it
Functions ¶
This section is empty.
Types ¶
type CodeList ¶
type CodeList interface { GetCodeLists(ctx context.Context, filterBy string) (*models.CodeListResults, error) GetCodeList(ctx context.Context, codeListID string) (*models.CodeList, error) GetEditions(ctx context.Context, codeListID string) (*models.Editions, error) GetEdition(ctx context.Context, codeListID, edition string) (*models.Edition, error) CountCodes(ctx context.Context, codeListID string, edition string) (int64, error) GetCodes(ctx context.Context, codeListID, edition string) (*models.CodeResults, error) GetCode(ctx context.Context, codeListID, edition string, code string) (*models.Code, error) GetCodeDatasets(ctx context.Context, codeListID, edition string, code string) (*models.Datasets, error) GetCodesOrder(ctx context.Context, codeListID string, codes []string) (codeOrders map[string]*int, err error) }
CodeList defines functions to retrieve code list and code nodes
type Dimension ¶
type Dimension interface {
InsertDimension(ctx context.Context, cache map[string]string, cacheMutex *sync.Mutex, instanceID string, d *models.Dimension) (*models.Dimension, error)
}
Dimension defines functions to create dimension nodes
type Driver ¶
type Driver interface { Close(ctx context.Context) error Healthcheck() (string, error) Checker(ctx context.Context, state *health.CheckState) 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 { // read HierarchyExists(ctx context.Context, instanceID, dimension string) (hierarchyExists bool, err error) GetHierarchyCodelist(ctx context.Context, instanceID, dimension string) (string, error) GetHierarchyRoot(ctx context.Context, instanceID, dimension string) (*models.HierarchyResponse, error) GetHierarchyElement(ctx context.Context, instanceID, dimension, code string) (*models.HierarchyResponse, error) GetCodesWithData(ctx context.Context, attempt int, instanceID, dimensionName string) (codes []string, err error) GetGenericHierarchyNodeIDs(ctx context.Context, attempt int, codeListID string, codes []string) (nodeIDs map[string]string, err error) GetGenericHierarchyAncestriesIDs(ctx context.Context, attempt int, codeListID string, codes []string) (nodeIDs map[string]string, err error) CountNodes(ctx context.Context, instanceID, dimensionName string) (count int64, err error) GetHierarchyNodeIDs(ctx context.Context, attempt int, instanceID, dimensionName string) (ids map[string]string, err error) // write CreateInstanceHierarchyConstraints(ctx context.Context, attempt int, instanceID, dimensionName string) error CloneNodes(ctx context.Context, attempt int, instanceID, codeListID, dimensionName string) error CloneNodesFromIDs(ctx context.Context, attempt int, instanceID, codeListID, dimensionName string, ids map[string]string, hasData bool) (err error) CloneRelationships(ctx context.Context, attempt int, instanceID, codeListID, dimensionName string) error CloneRelationshipsFromIDs(ctx context.Context, attempt int, instanceID, dimensionName string, ids map[string]string) error CreateHasCodeEdges(ctx context.Context, attempt int, codeListID string, codesById map[string]string) (err error) CloneOrderFromIDs(ctx context.Context, codeListID string, ids map[string]string) (err error) SetNumberOfChildren(ctx context.Context, attempt int, instanceID, dimensionName string) (err error) SetNumberOfChildrenFromIDs(ctx context.Context, attempt int, ids map[string]string) (err error) RemoveCloneEdges(ctx context.Context, attempt int, instanceID, dimensionName string) (err error) RemoveCloneEdgesFromSourceIDs(ctx context.Context, attempt int, ids map[string]string) (err 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 }
Hierarchy defines functions to create and retrieve generic and instance hierarchy nodes
type Instance ¶
type Instance interface { CreateInstanceConstraint(ctx context.Context, instanceID string) error CreateInstance(ctx context.Context, instanceID string, csvHeaders []string) error AddDimensions(ctx context.Context, instanceID string, dimensions []interface{}) error CreateCodeRelationship(ctx context.Context, instanceID, codeListID, code string) error InstanceExists(ctx context.Context, instanceID string) (bool, error) CountInsertedObservations(ctx context.Context, instanceID string) (count int64, err error) AddVersionDetailsToInstance(ctx context.Context, instanceID, datasetID, 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 significant // memory overhead. StreamCSVRows(ctx context.Context, instanceID, filterID string, filters *observation.DimensionFilters, limit *int) (observation.StreamRowReader, error) InsertObservationBatch(ctx context.Context, attempt int, instanceID string, observations []*models.Observation, dimensionIDs map[string]string) error }
Observation defines functions to create and retrieve observation nodes