repository

package
v0.0.0-...-a247b90 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when a record cannot be found

Functions

This section is empty.

Types

type DtdRepository

type DtdRepository interface {
	FindStationsByCrs(crs string) (*models.LocationData, error)
	FindFlowsForStations(src, dst string) ([]*models.FlowData, error)
	FindAllFlowsForStation(nlc string) ([]*models.FlowData, error)
	FindFaresForFlows(flowIds []string) ([]*models.FareDetail, error)
	FindFaresForNLCs(srcNlcs, dstNlcs []string) ([]*models.FareDetailExtreme, error)
	FindFareOverridesForNLCs(srcNlcs, dstNlcs []string) ([]*models.FareDetailExtreme, error)
	FindNLCsRelatedToCrs(crs string) ([]string, error)
	FindFlowsForNLCs(srcNlcs []string, dstNlcs []string) ([]*models.FlowDetail, error)
}

DtdRepository provides an abstraction between databases

type DtdRepositorySql

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

DtdRepositorySql is a concrete MySql implementation of a DtdRepository

func NewDtdRepositorySql

func NewDtdRepositorySql(options *DtdSqlDBOptions) (*DtdRepositorySql, error)

func (*DtdRepositorySql) FindAllFlowsForStation

func (dtd *DtdRepositorySql) FindAllFlowsForStation(nlc string) (flows []*models.FlowDetail, err error)

func (*DtdRepositorySql) FindFareOverridesForNLCs

func (dtd *DtdRepositorySql) FindFareOverridesForNLCs(srcNlcs, dstNlcs []string) (fares []*models.FareDetailExtreme, err error)

func (*DtdRepositorySql) FindFaresForFlows

func (dtd *DtdRepositorySql) FindFaresForFlows(flowIds []string) (fares []*models.FareDetail, err error)

func (*DtdRepositorySql) FindFaresForNLCs

func (dtd *DtdRepositorySql) FindFaresForNLCs(srcNlcs, dstNlcs []string, season bool, class string) (fares []*models.FareDetailExtreme, err error)

func (*DtdRepositorySql) FindFlowsForNLCs

func (dtd *DtdRepositorySql) FindFlowsForNLCs(srcNlcs []string, dstNlcs []string) (flows []*models.FlowDetail, err error)

func (*DtdRepositorySql) FindFlowsForStations

func (dtd *DtdRepositorySql) FindFlowsForStations(src, dst string) (flows []*models.FlowDetail, err error)

FindFlowsForStations returns all flows between two NLC codes

func (*DtdRepositorySql) FindNLCsRelatedToCrs

func (dtd *DtdRepositorySql) FindNLCsRelatedToCrs(crs string) (nlcs []string, err error)

func (*DtdRepositorySql) FindStationsByCrs

func (dtd *DtdRepositorySql) FindStationsByCrs(crs string) (stations []*models.LocationData, err error)

FindStationsByCrs returns locations from the given CRS code

type DtdSqlDBOptions

type DtdSqlDBOptions struct {
	Host, Port, User, Password, DBName string
}

DBOptions holds the information required to construct a DB connection

Jump to

Keyboard shortcuts

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