models

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FreqOrder = stringSlice{"A", "S", "Q", "M", "W", "D"}

Functions

This section is empty.

Types

type Application

type Application struct {
	Id       int64  `json:"id"`
	Name     string `json:"name"`
	Hostname string `json:"hostname"`
	APIKey   string `json:"apiKey"`
}

type ByFrequency

type ByFrequency []DataPortalFrequency

func (ByFrequency) Len

func (a ByFrequency) Len() int

func (ByFrequency) Less

func (a ByFrequency) Less(i, j int) bool

func (ByFrequency) Swap

func (a ByFrequency) Swap(i, j int)

type ByGeography

type ByGeography []DataPortalGeography

ByGeography/ByFrequency implement sort.Interface

func (ByGeography) Len

func (a ByGeography) Len() int

func (ByGeography) Less

func (a ByGeography) Less(i, j int) bool

func (ByGeography) Swap

func (a ByGeography) Swap(i, j int)

type Category

type Category struct {
	Id               int64                  `json:"id"`
	Name             string                 `json:"name"`
	Universe         string                 `json:"universe"`
	ParentId         int64                  `json:"parentId,omitempty"`
	IsHeader         bool                   `json:"isHeader,omitempty"`
	Description      string                 `json:"description,omitempty"`
	Defaults         *CategoryDefaults      `json:"defaults,omitempty"`
	Current          *CurrentGeoFreq        `json:"current,omitempty"`
	Geographies      *[]DataPortalGeography `json:"geos,omitempty"`
	Frequencies      *[]DataPortalFrequency `json:"freqs,omitempty"`
	ObservationStart *time.Time             `json:"observationStart,omitempty"`
	ObservationEnd   *time.Time             `json:"observationEnd,omitempty"`
}

type CategoryDefaults

type CategoryDefaults struct {
	Geography        *DataPortalGeography `json:"geo,omitempty"`
	Frequency        *DataPortalFrequency `json:"freq,omitempty"`
	ObservationStart *time.Time           `json:"observationStart,omitempty"`
	ObservationEnd   *time.Time           `json:"observationEnd,omitempty"`
}

type CategoryWithAncestry

type CategoryWithAncestry struct {
	Id                  int64
	Name                string
	Universe            string
	Ancestry            sql.NullString
	ParentId            sql.NullInt64
	IsHeader            bool
	Description         sql.NullString
	DefaultGeoHandle    sql.NullString
	DefaultGeoFIPS      sql.NullString
	DefaultGeoName      sql.NullString
	DefaultGeoShortName sql.NullString
	DefaultFrequency    sql.NullString
	ObservationStart    NullTime
	ObservationEnd      NullTime
}

type CategoryWithInflatedSeries

type CategoryWithInflatedSeries struct {
	Category
	Series []InflatedSeries `json:"series,omitempty"`
}

type CurrentGeoFreq

type CurrentGeoFreq struct {
	Geography        string     `json:"geo,omitempty"`
	Frequency        string     `json:"freq,omitempty"`
	ObservationStart *time.Time `json:"observationStart,omitempty"`
	ObservationEnd   *time.Time `json:"observationEnd,omitempty"`
}

type DataPortalAnalyzerPackage

type DataPortalAnalyzerPackage struct {
	Categories     []Category       `json:"categories,omitempty"`
	InflatedSeries []InflatedSeries `json:"series,omitempty"`
}

type DataPortalCategoryPackage

type DataPortalCategoryPackage struct {
	CatSubTree    []CategoryWithInflatedSeries `json:"categories"`
	NavCategories []Category                   `json:"navCategories,omitempty"`
}

type DataPortalForecast

type DataPortalForecast struct {
	Forecast string `json:"forecast"`
	Freq     string `json:"freq,omitempty"`
	Label    string `json:"label,omitempty"`
}

type DataPortalFrequency

type DataPortalFrequency struct {
	Freq             string     `json:"freq"`
	Label            string     `json:"label,omitempty"`
	ObservationStart *time.Time `json:"observationStart,omitempty"`
	ObservationEnd   *time.Time `json:"observationEnd,omitempty"`
}

type DataPortalGeography

type DataPortalGeography struct {
	FIPS             string     `json:"fips,omitempty"`
	Name             string     `json:"name,omitempty"`
	ShortName        string     `json:"shortName,omitempty"`
	Handle           string     `json:"handle"`
	ObservationStart *time.Time `json:"observationStart,omitempty"`
	ObservationEnd   *time.Time `json:"observationEnd,omitempty"`
}

type DataPortalObservation

type DataPortalObservation struct {
	Date          time.Time
	Value         float64
	PseudoHistory *bool
}

func (*DataPortalObservation) MarshalJSON

func (o *DataPortalObservation) MarshalJSON() ([]byte, error)

type DataPortalSearchPackage

type DataPortalSearchPackage struct {
	SearchSummary
	Series []InflatedSeries `json:"series,omitempty"`
}

type DataPortalSeries

type DataPortalSeries struct {
	Id                          int64                  `json:"id"`
	Name                        string                 `json:"name"`
	Universe                    string                 `json:"universe"`
	Title                       string                 `json:"title,omitempty"`
	Description                 string                 `json:"description,omitempty"`
	MeasurementId               int64                  `json:"measurementId,omitempty"`
	MeasurementName             string                 `json:"measurementName,omitempty"`
	Frequency                   string                 `json:"frequency,omitempty"`
	FrequencyShort              string                 `json:"frequencyShort,omitempty"`
	SeasonallyAdjusted          *bool                  `json:"seasonallyAdjusted,omitempty"`
	SeasonalAdjustment          string                 `json:"seasonalAdjustment,omitempty"`
	UnitsLabel                  string                 `json:"unitsLabel,omitEmpty"`
	UnitsLabelShort             string                 `json:"unitsLabelShort,omitEmpty"`
	Geography                   DataPortalGeography    `json:"geography,omitEmpty"`
	Percent                     *bool                  `json:"percent,omitempty"`
	Real                        *bool                  `json:"real,omitempty"`
	BaseYear                    *int64                 `json:"baseYear,omitempty"`
	BaseYearDeprecated          *int64                 `json:"base_year,omitempty"`
	Decimals                    *int64                 `json:"decimals,omitempty"`
	SourceDescription           string                 `json:"sourceDescription,omitempty"`
	SourceLink                  string                 `json:"sourceLink,omitempty"`
	SourceDescriptionDeprecated string                 `json:"source_description,omitempty"`
	SourceLinkDeprecated        string                 `json:"source_link,omitempty"`
	SourceDetails               string                 `json:"sourceDetails,omitempty"`
	Indent                      int                    `json:"indent,omitempty"`
	TablePrefix                 string                 `json:"tablePrefix,omitempty"`
	TablePostfix                string                 `json:"tablePostfix,omitempty"`
	Geographies                 *[]DataPortalGeography `json:"geos,omitempty"`
	Frequencies                 *[]DataPortalFrequency `json:"freqs,omitempty"`
}

type DataPortalSeriesPackage

type DataPortalSeriesPackage struct {
	Series       DataPortalSeries     `json:"series"`
	Categories   []Category           `json:"categories,omitempty"`
	Observations *SeriesObservations  `json:"observations,omitempty"`
	Siblings     []DataPortalSeries   `json:"siblings,omitempty"`
	Forecasts    []DataPortalForecast `json:"forecasts,omitempty"`
}

type Feedback

type Feedback struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Feedback string `json:"feedback"`
}

type Frequency

type Frequency struct {
	Freq             string
	Label            sql.NullString
	ObservationStart NullTime
	ObservationEnd   NullTime
}

type Geography

type Geography struct {
	FIPS             sql.NullString `json:"fips"`
	Name             sql.NullString `json:"name"`
	ShortName        sql.NullString `json:"shortName"`
	Handle           string         `json:"handle"`
	ObservationStart NullTime
	ObservationEnd   NullTime
}

type InflatedSeries

type InflatedSeries struct {
	DataPortalSeries
	Observations SeriesObservations `json:"seriesObservations"`
}

type Measurement

type Measurement struct {
	Id     int64  `json:"id"`
	Name   string `json:"name"`
	Indent int    `json:"indent,omitempty"`
}

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

from https://github.com/lib/pq/blob/master/encode.go

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Observation

type Observation struct {
	Date          time.Time
	Value         sql.NullFloat64
	PseudoHistory sql.NullBool
	Decimals      int
}

type SearchSummary

type SearchSummary struct {
	SearchText       string                 `json:"q"`
	DefaultGeo       *DataPortalGeography   `json:"defaultGeo,omitempty"`
	DefaultFreq      *DataPortalFrequency   `json:"defaultFreq,omitempty"`
	Geographies      *[]DataPortalGeography `json:"geos,omitempty"`
	Frequencies      *[]DataPortalFrequency `json:"freqs,omitempty"`
	ObservationStart *time.Time             `json:"observationStart"`
	ObservationEnd   *time.Time             `json:"observationEnd"`
}

type Series

type Series struct {
	Id                 int64
	Name               string
	Universe           string
	Description        sql.NullString
	Frequency          sql.NullString
	SeasonallyAdjusted sql.NullBool
	SeasonalAdjustment sql.NullString
	UnitsLabel         sql.NullString
	UnitsLabelShort    sql.NullString
	DataPortalName     sql.NullString
	Percent            sql.NullBool
	Real               sql.NullBool
	Decimals           sql.NullInt64
	BaseYear           sql.NullInt64
	SourceDescription  sql.NullString
	SourceLink         sql.NullString
	SourceDetails      sql.NullString
	Indent             sql.NullString
	TablePrefix        sql.NullString
	TablePostfix       sql.NullString
	MeasurementId      sql.NullInt64
	MeasurementName    sql.NullString
}

type SeriesObservations

type SeriesObservations struct {
	ObservationStart      time.Time              `json:"observationStart"`
	ObservationEnd        time.Time              `json:"observationEnd"`
	OrderBy               string                 `json:"orderBy"`
	SortOrder             string                 `json:"sortOrder"`
	TransformationResults []TransformationResult `json:"transformationResults"`
}

func (SeriesObservations) MarshalJSON

func (so SeriesObservations) MarshalJSON() ([]byte, error)

solid idea from stack overflow: http://choly.ca/post/go-json-marshalling/

type TransformationResult

type TransformationResult struct {
	Transformation    string   `json:"transformation"`
	ObservationDates  []string `json:"dates"`
	ObservationValues []string `json:"values"`
	ObservationPHist  []bool   `json:"pseudoHistory"`
}

Jump to

Keyboard shortcuts

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