Documentation
¶
Index ¶
- func DataPopulate(db *gorm.DB)
- func GetGeoTypeMap() map[string]bool
- func GetGeoTypeValues() []string
- func GetTopLevelGeoNames() map[string]string
- func Migrate(db *gorm.DB)
- func SetupDBOnceOnly(dsn string)
- func SetupUpdateDB(dsn string)
- type DataVer
- type Geo
- type GeoMetric
- type GeoType
- type NomisCategory
- type NomisDesc
- type NomisTopic
- type PostCode
- type SchemaVer
- type YearMapping
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataPopulate ¶
func GetGeoTypeMap ¶
GetGeoTypeValues returns a map of geo types for validation
func GetGeoTypeValues ¶
func GetGeoTypeValues() []string
GetGeoTypeValues returns a slice of geo types
func GetTopLevelGeoNames ¶
func SetupDBOnceOnly ¶
func SetupDBOnceOnly(dsn string)
special case for use in comptests - only setup db if it has not already been set up. This is safe to call multiple times against the same db.
func SetupUpdateDB ¶
func SetupUpdateDB(dsn string)
SetupUpdate is used both to create and update the database It's OK to call this more than once on the same DB
Types ¶
type DataVer ¶
type Geo ¶
type Geo struct {
ID int32 `gorm:"primaryKey"`
TypeID int32
Code string `gorm:"index:unique"`
Name string
WelshName string
Lat float64 // probably redundant use LongLatGeom
Long float64 // probably redundant use LongLatGeom
Valid bool `gorm:"DEFAULT:true"`
// wkb_geometry - added via ALTER don't migrate
Wkbgeometry sql.NullString `gorm:"column:wkb_geometry;-:migration"`
// wkb_long_lat_geom - added via ALTER don't migrate
WkbLongLatGeom sql.NullString `gorm:"column:wkb_long_lat_geom;-:migration"`
GoMetrics []GeoMetric `gorm:"foreignKey:GeoID;references:ID"`
PostCodes []PostCode `gorm:"foreignKey:GeoID;references:ID"`
}
type GeoMetric ¶
type GeoType ¶
type NomisCategory ¶
type NomisCategory struct {
// why do we need uniqueIndex? composite key!
ID int32 `gorm:"uniqueIndex;primaryKey"`
NomisDescID int32 `gorm:"primaryKey"`
CategoryName string
MeasurementUnit string
StatUnit string
LongNomisCode string `gorm:"uniqueIndex"`
Year int32
GoMetrics []GeoMetric `gorm:"foreignKey:CategoryID;references:ID"`
}
type NomisDesc ¶
type NomisTopic ¶
type PostCode ¶
type SchemaVer ¶
type YearMapping ¶
Click to show internal directories.
Click to hide internal directories.