mongo

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

func NewManager

func NewManager(db *mongo.Database) *Manager

NewManager creates a mongo manager.

func (*Manager) CreateTrip

func (m *Manager) CreateTrip(c context.Context, trip *base.Trip) (*TripRecord, error)

CreateTrip creates a trip.

func (*Manager) DeleteTrip

func (m *Manager) DeleteTrip(c context.Context, id id.TripID) error

DeleteTrip deletes trip by id.

func (*Manager) GetTrip

func (m *Manager) GetTrip(c context.Context, id id.TripID, accountID id.AccountID) (*TripRecord, error)

GetTrip gets a trip.

func (*Manager) GetTrips

func (m *Manager) GetTrips(c context.Context, accountID id.AccountID, status base.TripStatus) ([]*TripRecord, error)

GetTrips gets trips for the account by status. If status is not specified, gets all trips for the account.

func (*Manager) GetTripsByLimit

func (m *Manager) GetTripsByLimit(c context.Context, limit int64) ([]*TripRecord, error)

GetAllTrips gets trips by limit.

func (*Manager) UpdateTrip

func (m *Manager) UpdateTrip(c context.Context, tid id.TripID, aid id.AccountID, updatedAt int64, trip *base.Trip) error

UpdateTrip updates a trip.

type TripRecord

type TripRecord struct {
	mgutil.IDField        `bson:"inline"`
	mgutil.UpdatedAtField `bson:"inline"`
	Trip                  *base.Trip `bson:"trip"`
}

TripRecord defines a trip record in mongo db.

Jump to

Keyboard shortcuts

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