data

package
v0.0.0-...-9494c46 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Levels            = "lvl"
	YOYPercentChange  = "pc1"
	YTDPercentChange  = "ytdpc1"
	C5MAPercentChange = "c5mapc1"
	MOMPercentChange  = "mompc1"
	YOYChange         = "ch1"
	YTDChange         = "ytdch1"
	C5MAChange        = "c5mach1"
	MOMChange         = "momch1"
)

Variables

View Source
var FindViewTags *regexp.Regexp

Functions

func CreateNewApiKey

func CreateNewApiKey(size int) (key string, err error)

func GetCensusReqURI

func GetCensusReqURI(r *http.Request) string

func ReplaceTemplateTag

func ReplaceTemplateTag(query, tag, repl string) string

func RetrieveCached

func RetrieveCached(t *CensusTransport, r *http.Request) (*http.Response, error)

func SetCensusResponse

func SetCensusResponse(body *bytes.Buffer, contentType string) *http.Response

func SetErrorMsg

func SetErrorMsg(r *http.Request) (*http.Response, error)

func WriteCachePair

func WriteCachePair(r *http.Request, c *CacheRepository, payload []byte)

Types

type AppRepository

type AppRepository interface {
	CreateApplication(string, *models.Application) (int64, error)
	UpdateApplication(string, *models.Application) (int64, error)
	DeleteApplication(string, int64) (int64, error)
	GetAllApplications(string) ([]models.Application, error)
}

type ApplicationRepository

type ApplicationRepository struct {
	DB *sql.DB
}

type CacheRepository

type CacheRepository struct {
	Pool *redis.Pool
	TTL  int
}

func (*CacheRepository) GetCache

func (r *CacheRepository) GetCache(key string) ([]byte, error)

func (*CacheRepository) SetCache

func (r *CacheRepository) SetCache(key string, value []byte) (err error)

func (*CacheRepository) SetCachePair

func (r *CacheRepository) SetCachePair(key string, value []byte) (err error)

SetCachePair sets a pair of cache keys key (w/o expiration) and key:fresh (w/ expiration). Used for caching responses from the census proxy.

type CategoryRepository

type CategoryRepository struct {
	DB *sql.DB
}

type CensusTransport

type CensusTransport struct {
	CacheRepository *CacheRepository
}

func (*CensusTransport) RoundTrip

func (t *CensusTransport) RoundTrip(r *http.Request) (*http.Response, error)

type FooRepository

type FooRepository struct {
	DB             *sql.DB
	PortalView     string
	SeriesView     string
	DataPointsView string
	ReplaceViews   func([]byte) []byte
	ShowHidden     bool
}

func (*FooRepository) CreateAnalyzerPackage

func (r *FooRepository) CreateAnalyzerPackage(
	ids []int64,
	universe string,
	momTransformationOnly bool,
	categoryRepository *FooRepository,
) (pkg models.DataPortalAnalyzerPackage, err error)

func (*FooRepository) CreateApplication

func (r *FooRepository) CreateApplication(username string, application *models.Application) (numRows int64, err error)

func (*FooRepository) CreateCategoryPackage

func (r *FooRepository) CreateCategoryPackage(
	id int64,
	geo string,
	freq string,
	seriesRepository *FooRepository,
) (pkg models.DataPortalCategoryPackage, err error)

it seems this method is no longer used

func (*FooRepository) CreateExportPackage

func (r *FooRepository) CreateExportPackage(id int64, expand string) (pkg []models.InflatedSeries, err error)

func (*FooRepository) CreateSeriesPackage

func (r *FooRepository) CreateSeriesPackage(
	id int64,
	universe string,
	categoryId int64,
	forecast string,
	categoryRepository *FooRepository,
) (pkg models.DataPortalSeriesPackage, err error)

func (*FooRepository) DeleteApplication

func (r *FooRepository) DeleteApplication(username string, id int64) (numRows int64, err error)

func (*FooRepository) GetAllApplications

func (r *FooRepository) GetAllApplications(username string) (applications []models.Application, err error)

func (*FooRepository) GetAllCategories

func (r *FooRepository) GetAllCategories() (categories []models.Category, err error)

func (*FooRepository) GetAllCategoriesByUniverse

func (r *FooRepository) GetAllCategoriesByUniverse(universe string) (categories []models.Category, err error)

func (*FooRepository) GetApplicationById

func (r *FooRepository) GetApplicationById(username string, id int64) (application models.Application, err error)

func (*FooRepository) GetApplicationsByApiKey

func (r *FooRepository) GetApplicationsByApiKey(apiKey string) (applications []models.Application, err error)

func (*FooRepository) GetCategoriesByName

func (r *FooRepository) GetCategoriesByName(name string) (categories []models.Category, err error)

func (*FooRepository) GetCategoryById

func (r *FooRepository) GetCategoryById(id int64) (models.Category, error)

it seems this method is no longer used

func (*FooRepository) GetCategoryByIdGeoFreq

func (r *FooRepository) GetCategoryByIdGeoFreq(id int64, originGeo string, originFreq string) (models.Category, error)

it seems this method is no longer used

func (*FooRepository) GetCategoryRootByUniverse

func (r *FooRepository) GetCategoryRootByUniverse(universe string) (category models.Category, err error)

func (*FooRepository) GetCategoryRoots

func (r *FooRepository) GetCategoryRoots() (categories []models.Category, err error)

func (*FooRepository) GetChildrenOf

func (r *FooRepository) GetChildrenOf(id int64) (children []models.Category, err error)

func (*FooRepository) GetDefaultNavCategory

func (r *FooRepository) GetDefaultNavCategory(universe string) (category models.Category, err error)

func (*FooRepository) GetForecastByCategory

func (r *FooRepository) GetForecastByCategory(categoryId int64) (forecasts []string, err error)

func (*FooRepository) GetForecastsById

func (r *FooRepository) GetForecastsById(seriesId int64) (forecasts []models.DataPortalForecast, err error)

func (*FooRepository) GetFreqByCategory

func (r *FooRepository) GetFreqByCategory(categoryId int64, forecast string) (frequencies []models.DataPortalFrequency, err error)

func (*FooRepository) GetGeographiesByCategory

func (r *FooRepository) GetGeographiesByCategory(categoryId int64, forecast string) (geographies []models.DataPortalGeography, err error)

func (*FooRepository) GetInflatedSearchResultsByGeoAndFreq

func (r *FooRepository) GetInflatedSearchResultsByGeoAndFreq(searchText string, geo string, freq string) (seriesList []models.InflatedSeries, err error)

func (*FooRepository) GetInflatedSearchResultsByGeoAndFreqAndUniverse

func (r *FooRepository) GetInflatedSearchResultsByGeoAndFreqAndUniverse(
	searchText string,
	geo string,
	freq string,
	universeText string,
) (seriesList []models.InflatedSeries, err error)

func (*FooRepository) GetInflatedSeriesByGroup

func (r *FooRepository) GetInflatedSeriesByGroup(
	groupId int64,
	groupType GroupType,
) (seriesList []models.InflatedSeries, err error)

func (*FooRepository) GetInflatedSeriesByGroupGeoAndFreq

func (r *FooRepository) GetInflatedSeriesByGroupGeoAndFreq(
	groupId int64,
	geoHandle string,
	freq string,
	forecast string,
	groupType GroupType,
) (seriesList []models.InflatedSeries, err error)

func (*FooRepository) GetMeasurementsByCategory

func (r *FooRepository) GetMeasurementsByCategory(categoryId int64) (
	measurementList []models.Measurement,
	err error,
)

func (*FooRepository) GetNavCategories

func (r *FooRepository) GetNavCategories() (categories []models.Category, err error)

func (*FooRepository) GetNavCategoriesByUniverse

func (r *FooRepository) GetNavCategoriesByUniverse(universe string) (categories []models.Category, err error)

func (*FooRepository) GetSearchResultsByGeoAndFreq

func (r *FooRepository) GetSearchResultsByGeoAndFreq(searchText string, geo string, freq string) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSearchResultsByGeoAndFreqAndUniverse

func (r *FooRepository) GetSearchResultsByGeoAndFreqAndUniverse(
	searchText string,
	geo string,
	freq string,
	universeText string,
) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesByGroup

func (r *FooRepository) GetSeriesByGroup(
	groupId int64,
	groupType GroupType,
) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesByGroupAndFreq

func (r *FooRepository) GetSeriesByGroupAndFreq(
	groupId int64,
	freq string,
	groupType GroupType,
) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesByGroupAndGeo

func (r *FooRepository) GetSeriesByGroupAndGeo(
	groupId int64,
	geoHandle string,
	groupType GroupType,
) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesByGroupGeoAndFreq

func (r *FooRepository) GetSeriesByGroupGeoAndFreq(
	groupId int64,
	geoHandle string,
	freq string,
	forecast string,
	groupType GroupType,
) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesById

func (r *FooRepository) GetSeriesById(seriesId int64, categoryId int64) (dataPortalSeries models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesByName

func (r *FooRepository) GetSeriesByName(name, universe, expand string) (SeriesPkg models.DataPortalSeriesPackage, err error)

func (*FooRepository) GetSeriesBySearchText

func (r *FooRepository) GetSeriesBySearchText(searchText string) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesBySearchTextAndUniverse

func (r *FooRepository) GetSeriesBySearchTextAndUniverse(searchText string, universeText string) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesObservations

func (r *FooRepository) GetSeriesObservations(seriesId int64, expand string) (seriesObservations models.SeriesObservations, err error)

GetSeriesObservations returns an observations struct containing the default transformations. It checks the value of percent for the selected series and chooses the appropriate transformations.

It has now been turned into a decorator for a more flexible method that allows selection of transformations

func (*FooRepository) GetSeriesSiblingsById

func (r *FooRepository) GetSeriesSiblingsById(seriesId int64, forecast string, categoryId int64) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesSiblingsByIdAndFreq

func (r *FooRepository) GetSeriesSiblingsByIdAndFreq(
	seriesId int64,
	freq string,
) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesSiblingsByIdAndGeo

func (r *FooRepository) GetSeriesSiblingsByIdAndGeo(
	seriesId int64,
	geo string,
) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesSiblingsByIdGeoAndFreq

func (r *FooRepository) GetSeriesSiblingsByIdGeoAndFreq(
	seriesId int64,
	geo string,
	freq string,
) (seriesList []models.DataPortalSeries, err error)

func (*FooRepository) GetSeriesSiblingsFreqById

func (r *FooRepository) GetSeriesSiblingsFreqById(
	seriesId int64,
) (frequencyList []models.DataPortalFrequency, err error)

func (*FooRepository) GetSeriesSiblingsGeoById

func (r *FooRepository) GetSeriesSiblingsGeoById(seriesId int64) (geographies []models.DataPortalGeography, err error)

func (*FooRepository) GetSeriesTransformations

func (r *FooRepository) GetSeriesTransformations(seriesId int64, include boolSet, expand string) (seriesObservations models.SeriesObservations, err error)

func (*FooRepository) GetTransformation

func (r *FooRepository) GetTransformation(
	transformation string,
	seriesId int64,
	expand string,
	currentStart *time.Time,
	currentEnd *time.Time,
) (
	transformationResult models.TransformationResult,
	err error,
)

func (*FooRepository) InitializeFoo

func (r *FooRepository) InitializeFoo()

func (*FooRepository) RunQuery

func (r *FooRepository) RunQuery(query string, args ...interface{}) (*sql.Rows, error)

func (*FooRepository) RunQueryRow

func (r *FooRepository) RunQueryRow(query string, args ...interface{}) *sql.Row

func (*FooRepository) UpdateApplication

func (r *FooRepository) UpdateApplication(username string, application *models.Application) (numRows int64, err error)

type GeographyRepository

type GeographyRepository struct {
	DB *sql.DB
}

type GroupType

type GroupType int
const (
	Category GroupType = iota
	Measurement
)

type MeasurementRepository

type MeasurementRepository struct {
	DB *sql.DB
}

type SearchRepository

type SearchRepository struct {
	Categories *FooRepository
	Series     *FooRepository
}

func (*SearchRepository) CreateSearchPackage

func (r *SearchRepository) CreateSearchPackage(
	searchText string,
	geo string,
	freq string,
	universe string,
) (pkg models.DataPortalSearchPackage, err error)

func (*SearchRepository) GetSearchSummary

func (r *SearchRepository) GetSearchSummary(searchText string) (searchSummary models.SearchSummary, err error)

func (*SearchRepository) GetSearchSummaryByUniverse

func (r *SearchRepository) GetSearchSummaryByUniverse(searchText string, universeText string) (searchSummary models.SearchSummary, err error)

type SeriesRepository

type SeriesRepository struct {
	DB *sql.DB
}

Jump to

Keyboard shortcuts

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