models

package
v0.102.4 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package models holds the city fixture used by end-to-end adapter tests.

Index

Constants

View Source
const CitiesCollection = "DalgoTest_Cities"

CitiesCollection is the collection name of the city fixture.

Variables

View Source
var Cities = []City{
	{
		Name:          "Tokyo",
		State:         "Tokyo",
		Country:       "JP",
		Population:    37400068,
		AreaSqKm:      2187,
		IsCapital:     true,
		HasAirport:    true,
		Founded:       Year(1457),
		LastUpdatedAt: time.Now(),
	},
	{
		Name:          "Delhi",
		State:         "Delhi",
		Country:       "IN",
		Population:    30290936,
		AreaSqKm:      1484,
		IsCapital:     true,
		HasAirport:    true,
		Founded:       Year(1911),
		LastUpdatedAt: time.Now(),
	},
	{
		Name:          "Shanghai",
		State:         "Shanghai",
		Country:       "CN",
		Population:    27058480,
		AreaSqKm:      6340,
		IsCapital:     false,
		HasAirport:    true,
		Founded:       Year(1291),
		LastUpdatedAt: time.Now(),
	},
	{
		Name:          "São Paulo",
		State:         "São Paulo",
		Country:       "BR",
		Population:    22046000,
		AreaSqKm:      1521,
		IsCapital:     false,
		HasAirport:    true,
		Founded:       Year(1554),
		LastUpdatedAt: time.Now(),
	},
	{
		Name:          "Mumbai",
		State:         "Maharashtra",
		Country:       "IN",
		Population:    21344117,
		AreaSqKm:      603,
		IsCapital:     false,
		HasAirport:    true,
		Founded:       Year(1661),
		LastUpdatedAt: time.Now(),
	},
	{
		Name:          "Beijing",
		State:         "Beijing",
		Country:       "CN",
		Population:    21051600,
		AreaSqKm:      16410,
		IsCapital:     true,
		HasAirport:    true,
		Founded:       Year(1045),
		LastUpdatedAt: time.Now(),
	},
	{
		Name:          "Cairo",
		State:         "Cairo",
		Country:       "EG",
		Population:    20474100,
		AreaSqKm:      214,
		IsCapital:     true,
		HasAirport:    true,
		Founded:       Year(969),
		LastUpdatedAt: time.Now(),
	},
	{
		Name:          "Dhaka",
		State:         "Dhaka",
		Country:       "BD",
		Population:    20183500,
		AreaSqKm:      306,
		IsCapital:     true,
		HasAirport:    true,
		Founded:       Year(1608),
		LastUpdatedAt: time.Now(),
	},
	{
		Name:          "Karachi",
		State:         "Sindh",
		Country:       "PK",
		Population:    15741000,
		AreaSqKm:      3780,
		IsCapital:     false,
		HasAirport:    true,
		Founded:       Year(1729),
		LastUpdatedAt: time.Now(),
	},
	{
		Name:          "Istanbul",
		State:         "Istanbul",
		Country:       "TR",
		Population:    15029231,
		AreaSqKm:      5343,
		IsCapital:     false,
		HasAirport:    true,
		Founded:       Year(660),
		LastUpdatedAt: time.Now(),
	},
}

Cities holds the city values of the fixture.

View Source
var CityIDsSortedByPopulation []string

CityIDsSortedByPopulation holds city IDs in ascending population order. init fills it from Cities.

View Source
var SortedCityIDs []string

SortedCityIDs holds escaped city IDs in string order. init fills it from Cities.

Functions

func CityID

func CityID(city City) string

CityID returns an ID formed from the city's state and name.

func Year

func Year(year int) time.Time

Year returns midnight UTC on 1 January of year.

Types

type City

type City struct {
	Name          string
	State         string
	Country       string
	Population    int // in people
	AreaSqKm      int // in square kilometers
	IsCapital     bool
	HasAirport    bool
	Founded       time.Time
	LastUpdatedAt time.Time
}

City is one city in the fixture.

Jump to

Keyboard shortcuts

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