trip

package
v0.0.0-...-87a7744 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeoStoreKey = "trip-geo"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorType

type ErrorType int
const (
	InternalError ErrorType = iota
	ClientRelatedError
)

type Location

type Location struct {
	Lat, Long float32
}

type Repository

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

func NewRepository

func NewRepository(coll *mongo.Collection, rcl *redis.Client) *Repository

func (*Repository) CreateTrip

func (r *Repository) CreateTrip(ctx context.Context, trip Trip) (string, *TripError)

func (*Repository) DeleteTrip

func (r *Repository) DeleteTrip(ctx context.Context, tripID string) *TripError

func (*Repository) SearchTripByRadiusMeter

func (r *Repository) SearchTripByRadiusMeter(ctx context.Context, rad float64, loc Location) (*Trip, *TripError)

type Trip

type Trip struct {
	ID          primitive.ObjectID  `bson:"_id,omitempty"`
	RiderID     string              `bson:"rider_id"`
	Start       Location            `bson:"start"`
	Destination Location            `bson:"destination"`
	RideType    interface{}         `bson:"ride_type"`
	CreatedAt   primitive.Timestamp `bson:"created_at"`
}

type TripError

type TripError struct {
	Err    error
	Type   ErrorType
	Reason string
}

func NewClientRelatedTripError

func NewClientRelatedTripError(err error, reason string) *TripError

func NewInternalTripError

func NewInternalTripError(err error) *TripError

Jump to

Keyboard shortcuts

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