models

package
v0.0.0-...-8269def Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Objects map[string]*Object
)
View Source
var (
	UserList map[string]*User
)

Functions

func AddAgency

func AddAgency(m *GtfsAgency) (id int64, err error)

AddAgency insert a new GtfsAgency into database and returns last inserted Id on success.

func AddGtfsFareAttributes

func AddGtfsFareAttributes(price float64, agencyId int) int

AddGtfsFareAttributes insert a new GtfsFareAttributes into database and returns last inserted Id on success.

func AddGtfsFareRules

func AddGtfsFareRules(fareId int, routeId int)

AddGtfsFareRules insert a new GtfsFareRules into database and returns last inserted Id on success.

func AddGtfsStop

func AddGtfsStop(lat string, lng string) int64

func AddOne

func AddOne(object Object) (ObjectId string)

func AddRoute

func AddRoute(m *GtfsRoutes) (id int64, err error)

func AddRouteStations

func AddRouteStations(route_id int, tripLoc TripLocFloat)

func AddRoutesTickets

func AddRoutesTickets(m *RoutesTickets)

func AddStopTime

func AddStopTime(idStop int64, tripId int64, seq int, arrivalTime string, departureTime string)

func AddTrip

func AddTrip(routeId int) int64

func AddUser

func AddUser(u User) string

func Delete

func Delete(ObjectId string)

func DeleteAgency

func DeleteAgency(id int64) (err error)

DeleteAgency deletes GtfsAgency by Id and returns error if the record to be deleted doesn't exist

func DeleteUser

func DeleteUser(uid string)

func GetAll

func GetAll() map[string]*Object

func GetAllAgency

func GetAllAgency(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllAgency retrieves all GtfsAgency matches certain condition. Returns empty list if no records exist

func GetAllUsers

func GetAllUsers() map[string]*User

func GetLastBlock

func GetLastBlock() (uint64, error)

func Login

func Login(username, password string) bool

func RemoveStopsByIds

func RemoveStopsByIds(intIds []int64)

func SendBroadcastMessage

func SendBroadcastMessage(msg Message)

func SendBroadcasts

func SendBroadcasts()

func Update

func Update(ObjectId string, Score int64) (err error)

func UpdateAgencyById

func UpdateAgencyById(m *GtfsAgency) (err error)

UpdateAgency updates GtfsAgency by Id and returns error if the record to be updated doesn't exist

func UpdateAgencyByWallet

func UpdateAgencyByWallet(m *GtfsAgency) (err error)

func UpdateLastBlock

func UpdateLastBlock(newBlock uint64)

func UpdateRouteById

func UpdateRouteById(m *GtfsRoutes) (err error)

func WsData

func WsData() singleton

Types

type Blockchain

type Blockchain struct {
	Id    int `orm:"auto"`
	Block uint64
	Index uint64
}

type GtfsAgency

type GtfsAgency struct {
	AgencyId       int    `orm:"column(agency_id);null;pk"`
	AgencyName     string `orm:"column(agency_name)"`
	AgencyUrl      string `orm:"column(agency_url);null"`
	AgencyTimezone string `orm:"column(agency_timezone);null"`
	AgencyLang     string `orm:"column(agency_lang);null"`
	AgencyPhone    string `orm:"column(agency_phone);null"`
	AgencyFareUrl  string `orm:"column(agency_fare_url);null"`
	AgencyWallet   string `orm:"column(agency_wallet);null"`
	AgencyAddress  string `orm:"column(agency_address);null"`
}

func GetAgencyById

func GetAgencyById(id int64) (v *GtfsAgency, err error)

GetAgencyById retrieves GtfsAgency by Id. Returns error if Id doesn't exist

func GetAgencyByWallet

func GetAgencyByWallet(wallet string) (m GtfsAgency, err error)

func (*GtfsAgency) TableName

func (u *GtfsAgency) TableName() string

type GtfsCalendar

type GtfsCalendar struct {
	ServiceId int       `orm:"column(service_id);pk;null"`
	Monday    int       `orm:"column(monday)"`
	Tuesday   int       `orm:"column(tuesday)"`
	Wednesday int       `orm:"column(wednesday)"`
	Thursday  int       `orm:"column(thursday)"`
	Friday    int       `orm:"column(friday)"`
	Saturday  int       `orm:"column(saturday)"`
	Sunday    int       `orm:"column(sunday)"`
	StartDate time.Time `orm:"column(start_date);type(date)"`
	EndDate   time.Time `orm:"column(end_date);type(date)"`
}

func (*GtfsCalendar) TableName

func (u *GtfsCalendar) TableName() string

type GtfsFareAttributes

type GtfsFareAttributes struct {
	Id               int     `orm:"column(fare_id);pk;auto"`
	Price            float64 `orm:"column(price)"`
	CurrencyType     string  `orm:"column(currency_type)"`
	PaymentMethod    int     `orm:"column(payment_method);null"`
	Transfers        int     `orm:"column(transfers);null"`
	TransferDuration int     `orm:"column(transfer_duration);null"`
	AgencyId         int     `orm:"column(agency_id);"`
}

func (*GtfsFareAttributes) TableName

func (t *GtfsFareAttributes) TableName() string

type GtfsFareRules

type GtfsFareRules struct {
	FareId        int    `orm:"column(fare_id);pk"`
	RouteId       int    `orm:"column(route_id);"`
	OriginId      string `orm:"column(origin_id);null"`
	DestinationId string `orm:"column(destination_id);null"`
	ContainsId    string `orm:"column(contains_id);null"`
	ServiceId     string `orm:"column(service_id);null"`
}

func (*GtfsFareRules) TableName

func (u *GtfsFareRules) TableName() string

type GtfsFrequencies

type GtfsFrequencies struct {
	TripId           string `orm:"column(trip_id);null"`
	StartTime        string `orm:"column(start_time)"`
	EndTime          string `orm:"column(end_time)"`
	HeadwaySecs      int    `orm:"column(headway_secs)"`
	ExactTimes       int    `orm:"column(exact_times);null"`
	StartTimeSeconds int    `orm:"column(start_time_seconds);null"`
	EndTimeSeconds   int    `orm:"column(end_time_seconds);null"`
}

type GtfsRoutes

type GtfsRoutes struct {
	RouteId              int    `orm:"column(route_id);null;pk"`
	AgencyId             int    `orm:"column(agency_id);null"`
	RouteShortName       string `orm:"column(route_short_name);null"`
	RouteLongName        string `orm:"column(route_long_name);null"`
	RouteDesc            string `orm:"column(route_desc);null"`
	RouteType            int    `orm:"column(route_type);null"`
	RouteUrl             string `orm:"column(route_url);null"`
	RouteColor           string `orm:"column(route_color);null"`
	RouteTextColor       string `orm:"column(route_text_color);null"`
	TripWallet           string `orm:"column(trip_wallet);null"`
	Places               int    `orm:"column(places);null"`
	Schedule             string `orm:"column(schedule);null"`
	Enabled              bool   `orm:"column(enabled);null"`
	WheelchairAccessible bool   `orm:"column(wheelchair_accessible);null"`
}

func (*GtfsRoutes) TableName

func (u *GtfsRoutes) TableName() string

type GtfsStopTimes

type GtfsStopTimes struct {
	TripId               int     `orm:"column(trip_id);null"`
	ArrivalTime          string  `orm:"column(arrival_time);null"`
	DepartureTime        string  `orm:"column(departure_time);null"`
	StopId               int     `orm:"column(stop_id);pk;null"`
	StopSequence         int     `orm:"column(stop_sequence)"`
	StopHeadsign         string  `orm:"column(stop_headsign);null"`
	PickupType           int     `orm:"column(pickup_type);null"`
	DropOffType          int     `orm:"column(drop_off_type);null"`
	ShapeDistTraveled    float64 `orm:"column(shape_dist_traveled);null"`
	ArrivalTimeSeconds   int     `orm:"column(arrival_time_seconds);null"`
	DepartureTimeSeconds int     `orm:"column(departure_time_seconds);null"`
}

func (*GtfsStopTimes) TableName

func (u *GtfsStopTimes) TableName() string

type GtfsStops

type GtfsStops struct {
	StopId             int     `orm:"column(stop_id);null;pk"`
	StopName           string  `orm:"column(stop_name);null"`
	StopDesc           string  `orm:"column(stop_desc);null"`
	StopLat            float64 `orm:"column(stop_lat);null"`
	StopLon            float64 `orm:"column(stop_lon);null"`
	ZoneId             string  `orm:"column(zone_id);null"`
	StopUrl            string  `orm:"column(stop_url);null"`
	StopCode           string  `orm:"column(stop_code);null"`
	StopStreet         string  `orm:"column(stop_street);null"`
	StopCity           string  `orm:"column(stop_city);null"`
	StopRegion         string  `orm:"column(stop_region);null"`
	StopPostcode       string  `orm:"column(stop_postcode);null"`
	StopCountry        string  `orm:"column(stop_country);null"`
	LocationType       int     `orm:"column(location_type);null"`
	ParentStation      string  `orm:"column(parent_station);null"`
	StopTimezone       string  `orm:"column(stop_timezone);null"`
	WheelchairBoarding int     `orm:"column(wheelchair_boarding);null"`
	Direction          string  `orm:"column(direction);null"`
	Position           int     `orm:"column(position);null"`
	LocGeom            string  `orm:"column(loc_geom);null"`
}

func (*GtfsStops) TableName

func (u *GtfsStops) TableName() string

type GtfsTrips

type GtfsTrips struct {
	RouteId              int    `orm:"column(route_id);null"`
	ServiceId            int    `orm:"column(service_id);null"`
	TripId               int    `orm:"column(trip_id);pk;null"`
	TripHeadsign         string `orm:"column(trip_headsign);null"`
	DirectionId          int    `orm:"column(direction_id)"`
	BlockId              string `orm:"column(block_id);null"`
	ShapeId              string `orm:"column(shape_id);null"`
	TripShortName        string `orm:"column(trip_short_name);null"`
	WheelchairAccessible int    `orm:"column(wheelchair_accessible);null"`
	TripType             string `orm:"column(trip_type);null"`
}

func (*GtfsTrips) TableName

func (u *GtfsTrips) TableName() string

type Message

type Message struct {
	Message string `json:"message"`
	Time    string
}

type Object

type Object struct {
	ObjectId   string
	Score      int64
	PlayerName string
}

func GetOne

func GetOne(ObjectId string) (object *Object, err error)

type Profile

type Profile struct {
	Gender  string
	Age     int
	Address string
	Email   string
}

type RoutesStations

type RoutesStations struct {
	RouteId   int    `orm:"column(route_id);pk"`
	FromLabel string `orm:"column(from_label);null"`
	ToLabel   string `orm:"column(to_label);null"`
	FromGeom  string `orm:"column(from_geom);null"`
	ToGeom    string `orm:"column(to_geom);null"`
}

func (*RoutesStations) TableName

func (u *RoutesStations) TableName() string

type RoutesTickets

type RoutesTickets struct {
	TicketId    int    `orm:"column(ticket_id);pk"`
	RouteId     int    `orm:"column(route_id);"`
	Time        int    `orm:"column(time);null"`
	BuyerWallet string `orm:"column(buyer_wallet);null"`
}

func (*RoutesTickets) TableName

func (u *RoutesTickets) TableName() string

type ScheduleMap

type ScheduleMap map[string]interface{}

type TripLocFloat

type TripLocFloat struct {
	FromLat string
	FromLng string
	ToLat   string
	ToLng   string
}

type User

type User struct {
	Id       string
	Username string
	Password string
	Profile  Profile
}

func GetUser

func GetUser(uid string) (u *User, err error)

func UpdateUser

func UpdateUser(uid string, uu *User) (a *User, err error)

Jump to

Keyboard shortcuts

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