Documentation ¶
Index ¶
- Variables
- func GenerateMocksForMiddleware(flexCode int, datasetVersion int, filterType string) (*apimock.FilterFlexAPIMock, *apimock.DataStoreMock)
- type DataStore
- func (ds *DataStore) AddEventToFilterOutput(ctx context.Context, filterOutputID string, event *models.Event) error
- func (ds *DataStore) AddFilter(ctx context.Context, filterJob *models.Filter) (*models.Filter, error)
- func (ds *DataStore) AddFilterDimension(ctx context.Context, filterID, name string, options []string, ...) (newETag string, err error)
- func (ds *DataStore) AddFilterDimensionOption(ctx context.Context, filterID, name, option string, ...) (newETag string, err error)
- func (ds *DataStore) AddFilterDimensionOptions(ctx context.Context, filterID, name string, options []string, ...) (newETag string, err error)
- func (ds *DataStore) AgeDimension() *DataStore
- func (ds *DataStore) BadRequest() *DataStore
- func (ds *DataStore) ChangeInstanceRequest() *DataStore
- func (ds *DataStore) ConflictRequest() *DataStore
- func (ds *DataStore) CreateFilterOutput(ctx context.Context, filterJob *models.Filter) error
- func (ds *DataStore) DimensionNotFound() *DataStore
- func (ds *DataStore) GetFilter(ctx context.Context, filterID, eTagSelector string) (*models.Filter, error)
- func (ds *DataStore) GetFilterDimension(ctx context.Context, filterID string, name, eTagSelector string) (dimension *models.Dimension, err error)
- func (ds *DataStore) GetFilterOutput(ctx context.Context, filterID string) (*models.Filter, error)
- func (ds *DataStore) InternalError() *DataStore
- func (ds *DataStore) InvalidDimensionOption() *DataStore
- func (ds *DataStore) MissingPublicLinks() *DataStore
- func (ds *DataStore) NotFound() *DataStore
- func (ds *DataStore) OptionNotFound() *DataStore
- func (ds *DataStore) RemoveFilterDimension(ctx context.Context, filterID, name string, timestamp primitive.Timestamp, ...) (newETag string, err error)
- func (ds *DataStore) RemoveFilterDimensionOption(ctx context.Context, filterID string, name string, option string, ...) (newETag string, err error)
- func (ds *DataStore) RemoveFilterDimensionOptions(ctx context.Context, filterID string, name string, options []string, ...) (newETag string, err error)
- func (ds *DataStore) RunTransaction(ctx context.Context, retry bool, fn mongodriver.TransactionFunc) (interface{}, error)
- func (ds *DataStore) Unpublished() *DataStore
- func (ds *DataStore) UpdateFilter(ctx context.Context, updatedFilter *models.Filter, ...) (newETag string, err error)
- func (ds *DataStore) UpdateFilterOutput(ctx context.Context, filterJob *models.Filter, timestamp primitive.Timestamp) error
- func (ds *DataStore) VersionNotFound() *DataStore
- type DataStoreConfig
- type DatasetAPI
- func (ds *DatasetAPI) Get(ctx context.Context, userToken, svcToken, collectionID, datasetID string) (dataset.DatasetDetails, error)
- func (ds *DatasetAPI) GetOptionsBatchProcess(ctx context.Context, ...) (err error)
- func (ds *DatasetAPI) GetVersion(ctx context.Context, ...) (m dataset.Version, err error)
- func (ds *DatasetAPI) GetVersionDimensions(ctx context.Context, ...) (m dataset.VersionDimensions, err error)
- func (ds *DatasetAPI) InternalServiceError() *DatasetAPI
- func (ds *DatasetAPI) Unpublished() *DatasetAPI
- func (ds *DatasetAPI) VersionNotFound() *DatasetAPI
- type DatasetAPIConfig
- type FilterJob
- type MessageData
Constants ¶
This section is empty.
Variables ¶
var TestETag = "testETag"
TestETag represents an mocked base value for ETags
Functions ¶
func GenerateMocksForMiddleware ¶
func GenerateMocksForMiddleware(flexCode int, datasetVersion int, filterType string) (*apimock.FilterFlexAPIMock, *apimock.DataStoreMock)
Types ¶
type DataStore ¶
type DataStore struct { Cfg DataStoreConfig Mock *apimock.DataStoreMock // contains filtered or unexported fields }
DataStore holds the list of possible error flats along with the mocked datastore. This struct can be used directly as a mock, as it implements the required methods, or you can use the internal 'moq' Mock if you want ot validate calls, parameters etc.
func NewDataStore ¶
func NewDataStore() *DataStore
NewDataStore creates a new datastore mock with an empty config
func (*DataStore) AddEventToFilterOutput ¶
func (ds *DataStore) AddEventToFilterOutput(ctx context.Context, filterOutputID string, event *models.Event) error
AddEventToFilterOutput adds the given event to the filter output of the given ID
func (*DataStore) AddFilter ¶
func (ds *DataStore) AddFilter(ctx context.Context, filterJob *models.Filter) (*models.Filter, error)
AddFilter represents the mocked version of creating a filter blueprint to the datastore
func (*DataStore) AddFilterDimension ¶
func (ds *DataStore) AddFilterDimension(ctx context.Context, filterID, name string, options []string, dimensions []models.Dimension, timestamp primitive.Timestamp, eTagSelector string, currentFilter *models.Filter) (newETag string, err error)
AddFilterDimension represents the mocked version of creating a filter dimension to the datastore
func (*DataStore) AddFilterDimensionOption ¶
func (ds *DataStore) AddFilterDimensionOption(ctx context.Context, filterID, name, option string, timestamp primitive.Timestamp, eTagSelector string, currentFilter *models.Filter) (newETag string, err error)
AddFilterDimensionOption represents the mocked version of creating a filter dimension option to the datastore
func (*DataStore) AddFilterDimensionOptions ¶
func (ds *DataStore) AddFilterDimensionOptions(ctx context.Context, filterID, name string, options []string, timestamp primitive.Timestamp, eTagSelector string, currentFilter *models.Filter) (newETag string, err error)
AddFilterDimensionOptions represents the mocked version of adding a list of dimension options to the datastore
func (*DataStore) AgeDimension ¶
AgeDimension sets AgeDimension flag to true
func (*DataStore) BadRequest ¶
BadRequest sets BadRequest flag to true
func (*DataStore) ChangeInstanceRequest ¶
ChangeInstanceRequest sets ChangeInstanceRequest flag to true
func (*DataStore) ConflictRequest ¶
ConflictRequest sets ConflictRequest flag to true
func (*DataStore) CreateFilterOutput ¶
CreateFilterOutput represents the mocked version of creating a filter output to the datastore
func (*DataStore) DimensionNotFound ¶
DimensionNotFound sets DimensionNotFound flag to true
func (*DataStore) GetFilter ¶
func (ds *DataStore) GetFilter(ctx context.Context, filterID, eTagSelector string) (*models.Filter, error)
GetFilter represents the mocked version of getting a filter blueprint from the datastore
func (*DataStore) GetFilterDimension ¶
func (ds *DataStore) GetFilterDimension(ctx context.Context, filterID string, name, eTagSelector string) (dimension *models.Dimension, err error)
GetFilterDimension represents the mocked version of getting a filter dimension from the datastore
func (*DataStore) GetFilterOutput ¶
GetFilterOutput represents the mocked version of getting a filter output from the datastore
func (*DataStore) InternalError ¶
InternalError sets InternalError flag to true
func (*DataStore) InvalidDimensionOption ¶
InvalidDimensionOption sets InvalidDimensionOption flag to true
func (*DataStore) MissingPublicLinks ¶
MissingPublicLinks sets MissingPublicLinks flag to true
func (*DataStore) OptionNotFound ¶
OptionNotFound sets OptionNotFound flag to true
func (*DataStore) RemoveFilterDimension ¶
func (ds *DataStore) RemoveFilterDimension(ctx context.Context, filterID, name string, timestamp primitive.Timestamp, eTagSelector string, currentFilter *models.Filter) (newETag string, err error)
RemoveFilterDimension represents the mocked version of removing a filter dimension from the datastore
func (*DataStore) RemoveFilterDimensionOption ¶
func (ds *DataStore) RemoveFilterDimensionOption(ctx context.Context, filterID string, name string, option string, timestamp primitive.Timestamp, eTagSelector string, currentFilter *models.Filter) (newETag string, err error)
RemoveFilterDimensionOption represents the mocked version of removing a filter dimension option from the datastore
func (*DataStore) RemoveFilterDimensionOptions ¶
func (ds *DataStore) RemoveFilterDimensionOptions(ctx context.Context, filterID string, name string, options []string, timestamp primitive.Timestamp, eTagSelector string, currentFilter *models.Filter) (newETag string, err error)
RemoveFilterDimensionOptions represents the mocked version of removing a set of filter dimension options from the datastore
func (*DataStore) RunTransaction ¶
func (ds *DataStore) RunTransaction(ctx context.Context, retry bool, fn mongodriver.TransactionFunc) (interface{}, error)
func (*DataStore) Unpublished ¶
Unpublished sets Unpublished flag to true
func (*DataStore) UpdateFilter ¶
func (ds *DataStore) UpdateFilter(ctx context.Context, updatedFilter *models.Filter, timestamp primitive.Timestamp, eTagSelector string, currentFilter *models.Filter) (newETag string, err error)
UpdateFilter represents the mocked version of updating a filter blueprint from the datastore
func (*DataStore) UpdateFilterOutput ¶
func (ds *DataStore) UpdateFilterOutput(ctx context.Context, filterJob *models.Filter, timestamp primitive.Timestamp) error
UpdateFilterOutput represents the mocked version of updating a filter output from the datastore
func (*DataStore) VersionNotFound ¶
VersionNotFound sets VersionNotFound flag to true
type DataStoreConfig ¶
type DataStoreConfig struct { NotFound bool DimensionNotFound bool OptionNotFound bool VersionNotFound bool InternalError bool ChangeInstanceRequest bool InvalidDimensionOption bool Unpublished bool MissingPublicLinks bool BadRequest bool ConflictRequest bool AgeDimension bool }
DataStoreConfig represents a list of error flags to set error in mocked datastore
type DatasetAPI ¶
type DatasetAPI struct { Cfg DatasetAPIConfig Mock *apimock.DatasetAPIMock }
DatasetAPI holds the list of possible error flats along with the mocked dataset api calls. This struct can be used directly as a mock, as it implements the required methods, or you can use the internal 'moq' Mock if you want ot validate calls, parameters etc.
func NewDatasetAPI ¶
func NewDatasetAPI() *DatasetAPI
NewDatasetAPI creates a new dataset API mock with an empty config
func (*DatasetAPI) Get ¶
func (ds *DatasetAPI) Get(ctx context.Context, userToken, svcToken, collectionID, datasetID string) (dataset.DatasetDetails, error)
func (*DatasetAPI) GetOptionsBatchProcess ¶
func (ds *DatasetAPI) GetOptionsBatchProcess(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, id, edition, version, dimension string, optionIDs *[]string, processBatch dataset.OptionsBatchProcessor, batchSize int, maxWorkers int) (err error)
GetOptionsBatchProcess represents the mocked version of getting a list of dimension options from the dataset API
func (*DatasetAPI) GetVersion ¶
func (ds *DatasetAPI) GetVersion(ctx context.Context, userAuthToken, serviceAuthToken, downloadServiceAuthToken, collectionID, datasetID, edition, version string) (m dataset.Version, err error)
GetVersion represents the mocked version of getting an version document from dataset API
func (*DatasetAPI) GetVersionDimensions ¶
func (ds *DatasetAPI) GetVersionDimensions(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, id, edition, version string) (m dataset.VersionDimensions, err error)
GetVersionDimensions represents the mocked version of getting a list of dimensions from the dataset API
func (*DatasetAPI) InternalServiceError ¶
func (ds *DatasetAPI) InternalServiceError() *DatasetAPI
InternalServiceError sets InternalServiceError flag to true
func (*DatasetAPI) Unpublished ¶
func (ds *DatasetAPI) Unpublished() *DatasetAPI
Unpublished sets Unpublished flag to true
func (*DatasetAPI) VersionNotFound ¶
func (ds *DatasetAPI) VersionNotFound() *DatasetAPI
VersionNotFound sets VersionNotFound flag to true
type DatasetAPIConfig ¶
DatasetAPIConfig represents a list of error flags to set error in mocked dataset API
type FilterJob ¶
type FilterJob struct {
ReturnError bool
}
FilterJob contains a flag indicating whether the job has failed or not
type MessageData ¶
type MessageData struct {
FilterJobID string
}
MessageData contains the unique identifier for the filter job