Documentation ¶
Index ¶
- Variables
- func GetExternalIP() (string, error)
- func InitAppointmentDB(iMode int) error
- func InitCalendarDB(iMode int) error
- func InitCatalogDB(iMode int) error
- func InitLocationDB(iMode int) error
- func InitOrderDB(iMode int) error
- func InitOrgaDB(iMode int) error
- func InitRequirementDB(iMode int) error
- func InitResourceDB(iMode int) error
- func ServerInit(iMode int, iPath string) (err error)
- type CatOrderClass
- type CatQualification
- type CatSection
- type CatTrade
- type DataAppointment
- type DataLocationBuffer
- type DataOrder
- type DataProjekt
- type DataRequirement
- type DataResource
- type DataServiceArea
- type DataWorkingTimeCalendar
- type TLocation
- type TServer
- type TWorkingTimeDay
- type TWorkingTimeWeek
Constants ¶
This section is empty.
Variables ¶
var ( Server = TServer{ Mode: 0, Host: "127.0.0.1", Port: ":8000", DBName: "tmp/test.db", DBConfig: &gorm.Config{ NamingStrategy: schema.NamingStrategy{ SingularTable: true, }, Logger: logger.Default.LogMode(logger.Silent)}, Path: "", TestfileCatalog: "tmp/catalog.json", TestfileOrder: "tmp/order.json", TestfileOrga: "tmp/orga.json", TestfileResource: "tmp/resource.json", TestfileCalendar: "tmp/calendar.json", BingURLLocation: "https://dev.virtualearth.net/REST/v1/Locations/%s/%s/%s/%s?" + "includeNeighborhood=1&include=ciso2&maxResults=%d&key=%s", BingURLTimezone: "https://dev.virtualearth.net/REST/v1/TimeZone/?query=%s&key=%s", BingApiKey: "", } )
Functions ¶
func GetExternalIP ¶
externalIP determines the external IP address
func InitAppointmentDB ¶
func InitCalendarDB ¶
func InitCatalogDB ¶
func InitLocationDB ¶
InitLocationDB(iDB *gorm.DB) error initiates the DB tables for the job and all the dependent tables
func InitOrderDB ¶
InitOrderDB(iDB *gorm.DB) error initiates the DB tables for the job and all the dependent tables
func InitOrgaDB ¶
func InitRequirementDB ¶
InitRequirementDB(iDB *gorm.DB) error initiates the DB tables for the job and all the dependent tables
func InitResourceDB ¶
func ServerInit ¶
ServerInit Initialize server, read .env variables Initialize DB iMode int -> 0:run or 1:Testdaten iPath string -> path for data files
Types ¶
type CatOrderClass ¶
type CatOrderClass struct { Class string `json:"class" gorm:"primaryKey"` Name string `json:"name"` }
CatOrderClass - define Order class as customization
type CatQualification ¶
type CatQualification struct { Qualification string `json:"qualification" gorm:"primaryKey"` Name string `json:"name"` }
CatQualification - define Qualification as customization
type CatSection ¶
type CatSection struct { Section uint `json:"section" gorm:"primaryKey"` Name string `json:"name"` }
CatSection - define Appointment Section as customization
type DataAppointment ¶
type DataAppointment struct { ID uint `json:"id" gorm:"primaryKey; autoIncrement"` CreatedAt time.Time UpdatedAt time.Time OrderRef uint `json:"order_ref"` Order DataOrder `json:"order" gorm:"foreignKey:OrderRef"` ResourceRef string `json:"resource_ref"` Resource DataResource `json:"resource" gorm:"foreignKey:ResourceRef"` SectionRef uint `json:"section_ref"` Section CatSection `json:"section" gorm:"foreignKey:SectionRef"` }
type DataLocationBuffer ¶
type DataLocationBuffer struct { ID uint `json:"id" gorm:"primaryKey; autoIncrement"` CreatedAt time.Time UpdatedAt time.Time CountryCode string `json:"country_code"` PostCode string `json:"post_code"` RegionCode string `json:"region_code"` Town string `json:"town"` Street string `json:"street"` StreetNumber string `json:"street_number"` BuildingName string `json:"building_name"` TimeZone string `json:"timeZone"` GeoAltitude float64 `json:"geo_altitude"` GeoLatitude float64 `json:"geo_latitude"` GeoLongitude float64 `json:"geo_longitude"` GeoTimestamp time.Time `json:"geo_timestamp"` GeoServices string `json:"GeoServices"` }
DatLocationBuffer is the DB Buffer table for location and geo-location so we not need to recall bing REST
type DataOrder ¶
type DataOrder struct { ID uint `json:"id" gorm:"primaryKey; autoIncrement"` CreatedAt time.Time UpdatedAt time.Time Description string `json:"description"` OrderTypeRef string `json:"order_type_ref"` OrderType CatOrderClass `json:"order_type" gorm:"foreignKey:OrderTypeRef"` EarliestStart time.Time `json:"earliest_start"` LatestEnd time.Time `json:"latest_end"` Distress bool `json:"distress"` Priority int `json:"priority"` ProjectRef string `json:"project_ref"` Project DataProjekt `json:"project" gorm:"foreignKey:ProjectRef"` Duration time.Duration `json:"duration"` Location TLocation `json:"location" gorm:"embedded"` ContactPerson string `json:"contact_person"` Client string `json:"client"` Requirement DataRequirement `json:"requirement" gorm:"embedded"` PredecessorRef uint `json:"predecessor_ref"` ServiceAreaRef string `json:"service_area_ref"` ServiceArea DataServiceArea `json:"service_area" gorm:"foreignKey:ServiceAreaRef"` }
DatOrder - define data Order entity
type DataProjekt ¶
type DataRequirement ¶
type DataRequirement struct { ID uint `json:"id" gorm:"primaryKey; autoIncrement"` CreatedAt time.Time UpdatedAt time.Time TradeRef string `json:"trade_ref"` Trade CatTrade `json:"trade" gorm:"foreignKey:TradeRef"` QualificationRef string `json:"qualification_ref"` Qualification CatQualification `json:"qualification" gorm:"foreignKey:QualificationRef"` NumOfResources int `json:"num_of_resources"` ServiceAreaRef string ResourceRef string }
DatOrderRequirement are the order requirements as table
type DataResource ¶
type DataResource struct { ID string `json:"id" gorm:"primaryKey"` ValidFrom time.Time `json:"valid_from" gorm:"primaryKey"` CreatedAt time.Time UpdatedAt time.Time ValidTo time.Time `json:"valid_to"` Name string `json:"name"` HomeLocation TLocation `json:"home_location" gorm:"embedded"` Capacity []DataRequirement `json:"capacity" gorm:"foreignKey:ResourceRef"` CalendarRef string `json:"calendar_refer"` Calendar DataWorkingTimeCalendar `json:"calendar" gorm:"foreignKey:CalendarRef"` }
type DataServiceArea ¶
type DataServiceArea struct { ID string `json:"id" gorm:"primaryKey"` CreatedAt time.Time UpdatedAt time.Time Name string `json:"name"` Location TLocation `json:"location" gorm:"embedded"` Requirement []DataRequirement `json:"requirement" gorm:"foreignKey:ServiceAreaRef"` }
DataServiceArea Service area describes e.g. a branch office, temporal allocation of certain resources * Name, Designation * Address, geo-coordinates for starting point * Capacities per qualification
type DataWorkingTimeCalendar ¶
type DataWorkingTimeCalendar struct { ID string `json:"id" gorm:"primaryKey"` ValidFrom time.Time `json:"valid_from" gorm:"primaryKey"` CreatedAt time.Time UpdatedAt time.Time Name string `json:"name"` Week TWorkingTimeWeek `json:"week" gorm:"embedded"` OddWeek TWorkingTimeWeek `json:"odd_week" gorm:"embedded;embeddedPrefix:odd_"` }
type TLocation ¶
type TLocation struct { CountryCode string `json:"country_code"` PostCode string `json:"post_code"` RegionCode string `json:"region_code"` Town string `json:"town"` Street string `json:"street"` StreetNumber string `json:"street_number"` BuildingName string `json:"building_name"` BuildingFloor string `json:"building_floor"` BuildingRoom string `json:"building_room"` TimeZone string `json:"time_zone"` GeoAltitude float64 `json:"geo_altitude"` GeoLatitude float64 `json:"geo_latitude"` GeoLongitude float64 `json:"geo_longitude"` GeoTimestamp time.Time `json:"geo_timestamp"` GeoServices string `json:"GeoServices"` }
TLocation is the sub-struct for order location
func (*TLocation) GetGeoLocationFromBing ¶
func (me *TLocation) GetGeoLocationFromBing()
GetGeoLocationFromBing call Bing REST for GeoLocation
type TWorkingTimeDay ¶
type TWorkingTimeDay struct { StartMorning string `json:"start_morning"` EndMoning string `json:"end_moning"` ServiceAreaMorningRef string `json:"service_area_morning_ref"` ServiceAreaMorning DataServiceArea `json:"service_area_morning" gorm:"foreignKey:ServiceAreaMorningRef"` StartAfternoon string `json:"start_afternoon"` EndAfternoon string `json:"end_afternoon"` ServiceAreaAfternoonRef string `json:"service_area_afternoon_ref"` ServiceAreaAfternoon DataServiceArea `json:"service_area_afternoon" gorm:"foreignKey:ServiceAreaAfternoonRef"` }
type TWorkingTimeWeek ¶
type TWorkingTimeWeek struct { Sunday TWorkingTimeDay `json:"sunday" gorm:"embedded;embeddedPrefix:sun_"` Monday TWorkingTimeDay `json:"monday" gorm:"embedded;embeddedPrefix:mon_"` Tuesday TWorkingTimeDay `json:"tuesday" gorm:"embedded;embeddedPrefix:tue_"` Wednesday TWorkingTimeDay `json:"wednesday" gorm:"embedded;embeddedPrefix:wen_"` Thursday TWorkingTimeDay `json:"thursday" gorm:"embedded;embeddedPrefix:thu_"` Friday TWorkingTimeDay `json:"friday" gorm:"embedded;embeddedPrefix:fri_"` Saturday TWorkingTimeDay `json:"saturday" gorm:"embedded;embeddedPrefix:sat_"` }