data

package
v0.0.0-...-cc34eaa Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const UhFormat = "2006-01-02"

Variables

View Source
var Db *sql.DB
View Source
var ModDimList = map[string][]string{
	"trend":   {"markets", "destinations", "indicators"},
	"airseat": {"markets", "destinations", "indicators"},
	"hotel":   {"categories", "indicators"},
	"char":    {"groups", "indicators"},
	"exp":     {"groups", "categories", "indicators"},
}

Functions

func CreateDatabase

func CreateDatabase(connString string) (newDb *sql.DB, err error)

/////////////////////////////////////////////////////////////////////////////////////////////////

func GetDimAvailability

func GetDimAvailability(module string, indicators HandleList, groups HandleList, markets HandleList, destinations HandleList, categories HandleList) (result *map[string]HandleList, err error)

/////////////////////////////////////////////////////////////////////////////////////////////////

func GetFreqAvailability

func GetFreqAvailability(module string, indicators HandleList, groups HandleList, markets HandleList, destinations HandleList, categories HandleList) (result []string, err error)

/////////////////////////////////////////////////////////////////////////////////////////////////

Types

type Cache

type Cache struct {
	Prefix string
	Pool   *redis.Pool
	TTL    int
}

func CreateCache

func CreateCache(prefix string, pool *redis.Pool, ttlMin int) (r *Cache)

/////////////////////////////////////////////////////////////////////////////////////////////////

func (*Cache) GetCache

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

/////////////////////////////////////////////////////////////////////////////////////////////////

func (*Cache) SetCache

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

/////////////////////////////////////////////////////////////////////////////////////////////////

type Dimension

type Dimension struct {
	Module  string `json:"module"`
	Handle  string `json:"handle"`
	NameW   string `json:"nameW"`
	NameT   string `json:"nameT,omitempty"`
	Info    string `json:"info,omitempty"`
	Header  bool   `json:"header,omitempty"`
	Parent  string `json:"parent,omitempty"`
	Level   int    `json:"level"`
	Order   int    `json:"order"`
	Unit    string `json:"unit,omitempty"`
	Decimal string `json:"decimal,omitempty"`
}

func GetDimensionAll

func GetDimensionAll(dim string, mod string) (dimList []Dimension, err error)

/////////////////////////////////////////////////////////////////////////////////////////////////

type HandleList

type HandleList []string

type ScanDimension

type ScanDimension struct {
	Module  string
	Handle  string
	NameW   string
	NameT   sql.NullString
	Info    sql.NullString
	Header  bool
	Parent  sql.NullString
	Level   int
	Order   int
	Unit    sql.NullString
	Decimal sql.NullString
}

type ScanObservation

type ScanObservation struct {
	Dim1  sql.NullString
	Dim2  sql.NullString
	Dim3  sql.NullString
	Date  UhTime
	Value float32
}

type Series

type Series struct {
	Columns  []string  `json:"columns"`
	ObsStart UhTime    `json:"observationStart,omitempty"`
	ObsEnd   UhTime    `json:"observationEnd,omitempty"`
	Dates    []UhTime  `json:"dates"`
	Values   []float32 `json:"values"`
}

type SeriesResults

type SeriesResults struct {
	Module     string   `json:"module"`
	Frequency  string   `json:"frequency"`
	ObsStart   UhTime   `json:"observationStart,omitempty"`
	ObsEnd     UhTime   `json:"observationEnd,omitempty"`
	SeriesList []Series `json:"series"`
}

func GetCharacteristicData

func GetCharacteristicData(module, freq string, indicators, groups []string) (result *SeriesResults, err error)

/////////////////////////////////////////////////////////////////////////////////////////////////

func GetExpenditureData

func GetExpenditureData(module, freq string, indicators, groups, categories []string) (result *SeriesResults, err error)

/////////////////////////////////////////////////////////////////////////////////////////////////

func GetHotelData

func GetHotelData(module, freq string, indicators, categories []string) (result *SeriesResults, err error)

/////////////////////////////////////////////////////////////////////////////////////////////////

func GetTrendAirseatData

func GetTrendAirseatData(module, freq string, indicators, markets, destinations []string) (result *SeriesResults, err error)

/////////////////////////////////////////////////////////////////////////////////////////////////

type UhTime

type UhTime struct {
	time.Time
}

// Instead of a struct, could it just be an ALIAS for time.Time? // Would that make omitempty work?

func (UhTime) MarshalJSON

func (t UhTime) MarshalJSON() ([]byte, error)

/////////////////////////////////////////////////////////////////////////////////////////////////

func (UhTime) MarshalText

func (t UhTime) MarshalText() ([]byte, error)

/////////////////////////////////////////////////////////////////////////////////////////////////

Jump to

Keyboard shortcuts

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