Documentation ¶
Index ¶
- type Repo
- func (tr *Repo) BookTrip(uid string, input model.BookTripInput) (*Trip, error)
- func (tr *Repo) CancelTrip(ID, uid, reason string) (*Trip, error)
- func (tr *Repo) EndTrip(ID, uid string) (*Trip, error)
- func (tr *Repo) GetTripsByUser(ID string, status model.TripsInput) ([]*Trip, error)
- func (tr *Repo) StartTrip(ID, uid string) (*Trip, error)
- type Trip
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) CancelTrip ¶
CancelTrip cancels a non started trip
func (*Repo) GetTripsByUser ¶
GetTripsByUser gives a list of Trips by user ID
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
Click to show internal directories.
Click to hide internal directories.