model

package
v0.0.0-...-6eb7cd9 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBMigrate

func DBMigrate(db *gorm.DB) *gorm.DB

DBMigrate will create and migrate the tables, and then make the some relationships if necessary

Types

type CadastralTerritory

type CadastralTerritory struct {
	ID         uint   `gorm:"primary_key" json:"id"`
	Name       string `json:"name"`
	NameSearch string `json:"name_search"`
	CityID     uint   `json:"city_id"`
	City       City   `gorm:"foreignkey:CityID;association_foreignkey:ID" json:"city"`
}

CadastralTerritory structure

func (CadastralTerritory) MarshalJSON

func (ct CadastralTerritory) MarshalJSON() ([]byte, error)

MarshalJSON converts CadastralTerritory to CadastralTerritoryJSON

type CadastralTerritoryJSON

type CadastralTerritoryJSON struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
	City string `json:"city"`
}

CadastralTerritoryJSON CadastralTerritory representation for JSON

type City

type City struct {
	ID         uint   `gorm:"primary_key" json:"id"`
	Name       string `json:"name"`
	NameSearch string `json:"name_search"`
	CityParts  []CityPart
	Streets    []Street
	Places     []Place
}

City structure

func (City) MarshalJSON

func (c City) MarshalJSON() ([]byte, error)

MarshalJSON converts City to CityJSON

func (City) ToString

func (c City) ToString() string

ToString convert city struct to string

type CityJSON

type CityJSON struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
}

CityJSON structure

type CityPart

type CityPart struct {
	ID         uint   `gorm:"primary_key" json:"id"`
	Name       string `json:"name"`
	NameSearch string `json:"name_search"`
	CityID     uint   `json:"city_id"`
	City       City   `gorm:"foreignkey:CityID;association_foreignkey:ID" json:"city"`
	Streets    []Street
	Places     []Place
}

CityPart structure

func (CityPart) MarshalJSON

func (cp CityPart) MarshalJSON() ([]byte, error)

MarshalJSON converts CityPart to CityPartJSON

func (CityPart) ToString

func (cp CityPart) ToString() string

ToString convert city part struct to string

type CityPartJSON

type CityPartJSON struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
	City string `json:"city"`
}

CityPartJSON structure

type Place

type Place struct {
	ID         uint     `gorm:"primary_key" json:"id"`
	E          uint32   `json:"e,omitempty"`
	P          uint32   `json:"p,omitempty"`
	O          string   `gorm:"size:10" json:"o,omitempty"`
	Zip        string   `gorm:"size:5" json:"zip"`
	X          float64  `json:"x,omitempty"`
	Y          float64  `json:"y,omitempty"`
	Longitude  float64  `json:"lng,omitempty"`
	Latitude   float64  `json:"lat,omitempty"`
	StreetID   uint     `json:"-"`
	CityID     uint     `json:"-"`
	CityPartID uint     `json:"-"`
	Street     Street   `gorm:"foreignkey:StreetID;association_foreignkey:ID" json:"street"`
	City       City     `gorm:"foreignkey:CityID;association_foreignkey:ID" json:"city"`
	CityPart   CityPart `gorm:"foreignkey:CityPartID;association_foreignkey:ID" json:"city_part"`
}

Place structure

func (Place) MarshalJSON

func (p Place) MarshalJSON() ([]byte, error)

MarshalJSON converts Place to PlaceJSON

func (Place) PlaceNumber

func (p Place) PlaceNumber() string

PlaceNumber returns correct address place number

func (Place) ToString

func (p Place) ToString() string

ToString convert city part struct to string

type PlaceJSON

type PlaceJSON struct {
	ID            uint    `json:"id"`
	E             uint32  `json:"e,omitempty"`
	P             uint32  `json:"p,omitempty"`
	O             string  `json:"o,omitempty"`
	Zip           string  `json:"zip"`
	Longitude     float64 `json:"lng"`
	Latitude      float64 `json:"lat"`
	Street        string  `json:"street"`
	City          string  `json:"city"`
	CityPart      string  `json:"city_part"`
	AddressString string  `json:"address_string"`
}

PlaceJSON Place representation for JSON

type Street

type Street struct {
	ID         uint     `gorm:"primary_key" json:"id"`
	Name       string   `json:"name"`
	NameSearch string   `json:"name_search"`
	CityID     uint     `json:"city_id"`
	CityPartID uint     `json:"city_part_id"`
	City       City     `gorm:"foreignkey:CityID;association_foreignkey:ID" json:"city"`
	CityPart   CityPart `gorm:"foreignkey:CityPartID;association_foreignkey:ID" json:"city_part"`
	Places     []Place
}

Street structure

func (Street) MarshalJSON

func (s Street) MarshalJSON() ([]byte, error)

MarshalJSON converts Street to StreetJSON

func (Street) ToString

func (s Street) ToString() string

ToString convert street struct to string

type StreetJSON

type StreetJSON struct {
	ID       uint   `json:"id"`
	Name     string `json:"name"`
	City     string `json:"city"`
	CityPart string `json:"city_part"`
}

StreetJSON structure

Jump to

Keyboard shortcuts

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