models

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvClientId     = "TB_CLIENT_ID"
	EnvClientSecret = "TB_CLIENT_SECRET"
	EnvEvaNr        = "TB_EVA_NR"
	EnvNextStation  = "TB_NEXT_STATION"
	EnvLogLevel     = "TB_LOG_LEVEL"
)
View Source
const DateFormat = "060102"

Variables

This section is empty.

Functions

func GetLogLevel

func GetLogLevel(getEnv func(string) (string, bool)) (log.Level, bool)

GetLogLevel checks if the env variable is set and parses the log level from it. It returns the parsed log level and a boolean indicating that it was successfully parsed. 'false' means that the default log level was returned.

Types

type Connection added in v1.0.1

type Connection struct {
	Text            string `xml:",chardata"`
	PlannedTime     string `xml:"pt,attr"`
	PlannedPlatform string `xml:"pp,attr"`
	L               string `xml:"l,attr"`
	PlannedPath     string `xml:"ppth,attr"`
	Wings           string `xml:"wings,attr"`
}

type EnvVars

type EnvVars struct {
	// contains filtered or unexported fields
}

func GetEnvVars

func GetEnvVars(getEnv func(string) (string, bool)) (*EnvVars, error)

func (*EnvVars) ClientId

func (e *EnvVars) ClientId() string

func (*EnvVars) ClientSecret

func (e *EnvVars) ClientSecret() string

func (*EnvVars) EvaNr

func (e *EnvVars) EvaNr() string

func (*EnvVars) NextStation

func (e *EnvVars) NextStation() string

type Settings

type Settings struct {
	// contains filtered or unexported fields
}

func NewSettings

func NewSettings(evaNr, trainStation, nextStation string) *Settings

func (*Settings) EvaNr

func (s *Settings) EvaNr() string

func (*Settings) NextStation

func (s *Settings) NextStation() string

func (*Settings) TrainStation

func (s *Settings) TrainStation() string

type Station

type Station struct {
	Name  string
	EvaNr string
}

type Stations

type Stations struct {
	XMLName xml.Name `xml:"stations"`
	Text    string   `xml:",chardata"`
	Station []struct {
		Text       string `xml:",chardata"`
		Name       string `xml:"name,attr"`
		Eva        string `xml:"eva,attr"`
		Ds100      string `xml:"ds100,attr"`
		Db         string `xml:"db,attr"`
		Creationts string `xml:"creationts,attr"`
		Meta       string `xml:"meta,attr"`
	} `xml:"station"`
}

type TemplateData

type TemplateData struct {
	TrainStation string
	NextStation  string
	Trains       []*Train
}

type Timetable

type Timetable struct {
	XMLName xml.Name `xml:"timetable"`
	Text    string   `xml:",chardata"`
	Station string   `xml:"station,attr"`
	Stops   []struct {
		Text      string `xml:",chardata"`
		ID        string `xml:"id,attr"`
		TripLabel struct {
			Text string `xml:",chardata"`
			F    string `xml:"f,attr"`
			T    string `xml:"t,attr"`
			O    string `xml:"o,attr"`
			C    string `xml:"c,attr"`
			N    string `xml:"n,attr"`
		} `xml:"tl"`
		Arrival struct {
			Connection
			Pde string `xml:"pde,attr"`
		} `xml:"ar"`
		Departure struct {
			Connection
		} `xml:"dp"`
	} `xml:"s"`
}

type Train

type Train struct {
	Time      string
	Path      string
	IsArrival bool
}

Jump to

Keyboard shortcuts

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