trip

package
v0.0.0-...-c435964 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo struct {
	DB *pg.DB
}

Repo contains all Trips related functions

func (*Repo) BookTrip

func (tr *Repo) BookTrip(uid string, input model.BookTripInput) (*Trip, error)

BookTrip books a trip

func (*Repo) CancelTrip

func (tr *Repo) CancelTrip(ID, uid, reason string) (*Trip, error)

CancelTrip cancels a non started trip

func (*Repo) EndTrip

func (tr *Repo) EndTrip(ID, uid string) (*Trip, error)

EndTrip stops a started a trip

func (*Repo) GetTripsByUser

func (tr *Repo) GetTripsByUser(ID string, status model.TripsInput) ([]*Trip, error)

GetTripsByUser gives a list of Trips by user ID

func (*Repo) StartTrip

func (tr *Repo) StartTrip(ID, uid string) (*Trip, error)

StartTrip starts a trip at cur time

type Trip

type Trip struct {
	ID          string            `json:"id" pg:"type:uuid,default:gen_random_uuid()"`
	Pickup      *model.Location   `json:"pickup" pg:",notnull"`
	Destination *model.Location   `json:"destination" pg:",notnull"`
	CabID       string            `json:"cab" pg:"type:uuid,notnull"`
	UserID      string            `json:"user" pg:"type:uuid,notnull"`
	Amount      *model.Cash       `json:"amount" pg:",notnull"`
	StartTime   *time.Time        `json:"startTime" pg:"type:timestamp"`
	EndTime     *time.Time        `json:"endTime" pg:"type:timestamp"`
	Canceled    *model.CancelTrip `json:"canceled"`
	Completed   bool              `json:"completed" pg:",use_zero,notnull"`
}

Trip type

Jump to

Keyboard shortcuts

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