Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func New

func New(c map[string]string) error

Types

type Driver

type Driver struct {
	Id                   primitive.ObjectID   `json:"id" bson:"_id"`
	TransportOperatorIds []primitive.ObjectID `json:"transportOperatorIds" bson:"transportOperatorIds"`
	LicenseNumber        string               `json:"licenseNumber" bson:"licenseNumber"`
	DateOfBirth          time.Time            `json:"dateOfBirth" bson:"dateOfBirth"`
	Firstnames           string               `json:"firstnames" bson:"firstnames"`
	Surname              string               `json:"surname" bson:"surname"`
	CreatedAt            time.Time            `json:"createdAt" bson:"createdAt"`
}

func (*Driver) Create

func (d *Driver) Create() error

func (*Driver) Exists

func (d *Driver) Exists() bool

func (*Driver) Find

func (d *Driver) Find() error

type Redis

type Redis struct {
	Key            string
	ExpireDuration time.Duration
}

func (*Redis) Expire

func (r *Redis) Expire()

func (*Redis) Get

func (r *Redis) Get() (string, error)

func (*Redis) Set

func (r *Redis) Set(value string)

type Token

type Token struct {
	AccessToken         string             `json:"accessToken,omitempty"`
	AccessTokenExpires  time.Time          `json:"accessTokenExpires,omitempty"`
	RefreshToken        string             `json:"refreshToken,omitempty"`
	RefreshTokenExpires time.Time          `json:"refreshTokenExpires,omitempty"`
	UserId              primitive.ObjectID `json:"userId,omitempty"`
	RoleIds             []int              `json:"roleIds,omitempty"`
}

type TransportOperator

type TransportOperator struct {
	Id            primitive.ObjectID   `json:"id" bson:"_id"`
	UserIds       []primitive.ObjectID `json:"userIds" bson:"userIds"`
	LicenseNumber string               `json:"licenseNumber" bson:"licenseNumber"`
	Name          string               `json:"name" bson:"name"`
	CreatedAt     time.Time            `json:"createdAt" bson:"createdAt"`
}

func (*TransportOperator) Create

func (t *TransportOperator) Create() error

func (*TransportOperator) Exists

func (t *TransportOperator) Exists() bool

func (*TransportOperator) Find

func (t *TransportOperator) Find() error

type User

type User struct {
	Id              primitive.ObjectID `json:"id,omitempty" bson:"_id"`
	Phone           string             `json:"phone,omitempty" bson:"phone"`
	Email           string             `json:"email,omitempty" bson:"email"`
	IsEmailVerified bool               `json:"isEmailVerified,omitempty" bson:"isEmailVerified"`
	Password        string             `json:"password,omitempty" bson:"password"`
	Pin             string             `json:"pin,omitempty" bson:"pin"`
	IsDriver        bool               `json:"isDriver,omitempty" bson:"isDriver"`
	RoleIds         []int              `json:"roleIds,omitempty" bson:"roleIds"`
	CreatedAt       time.Time          `json:"createdAt" bson:"createdAt"`
}

func (*User) Create

func (u *User) Create() error

func (*User) Exists

func (u *User) Exists() bool

func (*User) Find

func (u *User) Find() error

func (*User) IssueToken

func (u *User) IssueToken(c conf.Config) (*Token, error)

func (*User) PasswordLogin

func (u *User) PasswordLogin() error

func (*User) Update

func (u *User) Update() error

type Vehicle

type Vehicle struct {
	Id           primitive.ObjectID `json:"id" bson:"_id"`
	DriverId     primitive.ObjectID `json:"driverId" bson:"driverId"`
	Registration string             `json:"registration" bson:"registration"`
	IsDiesel     bool               `json:"isDiesel" bson:"isDiesel"`
	CreatedAt    time.Time          `json:"createdAt" bson:"createdAt"`
}

func (*Vehicle) Create

func (v *Vehicle) Create() error

func (*Vehicle) Delete

func (v *Vehicle) Delete() error

func (*Vehicle) Exists

func (v *Vehicle) Exists() bool

func (*Vehicle) Find

func (v *Vehicle) Find() error

func (*Vehicle) FindByDriverId

func (v *Vehicle) FindByDriverId() ([]Vehicle, error)