model

package
v0.0.0-...-afd247e Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close 关闭

func New

func New(c map[string]string) (err error)

New 创建连接并传入config

Types

type Address

type Address string

Address 位置信息

func (Address) GetCoorsFromAddr

func (addr Address) GetCoorsFromAddr() (coors Coors, err error)

GetCoorsFromAddr 通过位置获取坐标信息

type Coors

type Coors struct {
	Lat float64 `bson:"lat" json:"lat" valid:"required"`
	Lng float64 `bson:"lng" json:"lng" valid:"required"`
}

Coors represents a location on the Earth.

func (*Coors) EmptyCoors

func (coors *Coors) EmptyCoors() bool

EmptyCoors 判断coors是否为空

func (Coors) GetAddrFromCoors

func (coors Coors) GetAddrFromCoors() (addr Address, err error)

GetAddrFromCoors 通过坐标信息获取位置

type DrivingLoc

type DrivingLoc struct {
	ID        primitive.ObjectID `bson:"_id" json:"id" valid:"-"`
	DriverID  primitive.ObjectID `bson:"driverID" json:"driverID" valid:"required"`
	CreatedAt time.Time          `bson:"createdAt" json:"createdAt" valid:"required"`
	Coors     Coors              `bson:"coors" json:"coors" valid:"required"`
}

DrivingLoc 司机在行驶过程中的位置信息

func GetDrivingLocs

func GetDrivingLocs(driverID primitive.ObjectID, from, to time.Time) ([]DrivingLoc, error)

GetDrivingLocs 通过driverID和指定时间段返回司机行驶位置信息

func (*DrivingLoc) Save

func (dLoc *DrivingLoc) Save() error

Save 保存司机行驶的位置信息到数据库

Jump to

Keyboard shortcuts

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