models

package
v0.0.0-...-3b07eb7 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NearestDistance        = 50 //km distance nearest
	NearestTopCount        = 10 //top# nearest distance
	VehicleStatusOpen      = "open"
	VehicleStatusBooked    = "booked"
	VehicleStatusCanceled  = "canceled"
	VehicleStatusTripStart = "trip-start"
	VehicleStatusTripEnd   = "trip-end"
	VehicleStatusCompleted = "completed"
	VehicleStatusGasUp     = "gas-up"
	VehicleStatusPanic     = "panic"
)
View Source
const (
	UserTypeCustomer = "customer"
	UserTypeDriver   = "driver"
)
View Source
const (
	UserStatusPending = "pending"
	UserStatusActive  = "active"
	UserStatusDeleted = "deleted"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Booking

type Booking struct {
	ID             int64   `json:"id"`
	MobileCustomer string  `json:"mobile_customer"`
	MobileDriver   string  `json:"mobile_driver"`
	Src            string  `json:"src"`
	SrcLatitude    float64 `json:"src_latitude"`
	SrcLongitude   float64 `json:"src_longitude"`
	Dst            string  `json:"dst"`
	DstLatitude    float64 `json:"dst_latitude"`
	DstLongitude   float64 `json:"dst_longitude"`
	Status         string  `json:"status"`
	PickupTime     string  `json:"pickup_time"`
	Dropofftime    string  `json:"dropoff_time"`
	Remarks        string  `json:"remarks"`
	RemarksBy      string  `json:"remarks_by"`
	Created        string  `json:"created"`
	Modified       string  `json:"modified"`
}

func (*Booking) Bind

func (u *Booking) Bind(r *http.Request) error

func (*Booking) CreateBooking

func (u *Booking) CreateBooking(ctx context.Context, db *sql.DB, data *Booking) (bool, error)

func (*Booking) DeleteBooking

func (u *Booking) DeleteBooking(ctx context.Context, db *sql.DB, id string) (bool, error)

func (*Booking) Exists

func (u *Booking) Exists(ctx context.Context, db *sql.DB, id int) int

func (*Booking) GetBooking

func (u *Booking) GetBooking(ctx context.Context, db *sql.DB, id string) (*Booking, error)

func (*Booking) UpdateBooking

func (u *Booking) UpdateBooking(ctx context.Context, db *sql.DB, data *Booking) (bool, error)

func (*Booking) UpdateBookingDropoffTime

func (u *Booking) UpdateBookingDropoffTime(ctx context.Context, db *sql.DB, data *Booking) (bool, error)

func (*Booking) UpdateBookingPickupTime

func (u *Booking) UpdateBookingPickupTime(ctx context.Context, db *sql.DB, data *Booking) (bool, error)

func (*Booking) UpdateBookingStatus

func (u *Booking) UpdateBookingStatus(ctx context.Context, db *sql.DB, data *Booking) (bool, error)

type ChangePassworInfo

type ChangePassworInfo struct {
	Mobile string `json:"mobile"`
	Pass   string `json:"pass"`
	Type   string `json:"type"`
}

type ChangeStatusInfo

type ChangeStatusInfo struct {
	Mobile string `json:"mobile"`
	Status string `json:"pass"`
	Type   string `json:"type"`
}

type Customer

type Customer User

func (*Customer) Bind

func (u *Customer) Bind(r *http.Request) error

func (*Customer) CreateCustomer

func (u *Customer) CreateCustomer(ctx context.Context, db *sql.DB, data *Customer) (bool, error)

func (*Customer) DeleteCustomer

func (u *Customer) DeleteCustomer(ctx context.Context, db *sql.DB, mobile string) (bool, error)

func (*Customer) Exists

func (u *Customer) Exists(ctx context.Context, db *sql.DB, mobile string) int

func (*Customer) GetCustomer

func (u *Customer) GetCustomer(ctx context.Context, db *sql.DB, mobile string) (*Customer, error)

func (*Customer) UpdateCustomer

func (u *Customer) UpdateCustomer(ctx context.Context, db *sql.DB, data *Customer) (bool, error)

func (*Customer) UpdateCustomerCoords

func (u *Customer) UpdateCustomerCoords(ctx context.Context, db *sql.DB, data *Customer) (bool, error)

func (*Customer) UpdateCustomerOtp

func (u *Customer) UpdateCustomerOtp(ctx context.Context, db *sql.DB, mobile, otp, otpexp string) (bool, error)

func (*Customer) UpdateCustomerOtpExpiry

func (u *Customer) UpdateCustomerOtpExpiry(ctx context.Context, db *sql.DB, data *Customer) (bool, error)

func (*Customer) UpdateCustomerPass

func (u *Customer) UpdateCustomerPass(ctx context.Context, db *sql.DB, data *Customer) (bool, error)

func (*Customer) UpdateCustomerPassTmp

func (u *Customer) UpdateCustomerPassTmp(ctx context.Context, db *sql.DB, data *Customer) (bool, error)

func (*Customer) UpdateCustomerStatus

func (u *Customer) UpdateCustomerStatus(ctx context.Context, db *sql.DB, status, mobile string) (bool, error)

type DriveListInfo

type DriveListInfo struct {
	ID            int64   `json:"id"`
	Mobile        string  `json:"mobile"`
	Firstname     string  `json:"firstname"`
	Lastname      string  `json:"lastname"`
	Latitude      float64 `json:"latitude"`
	Longitude     float64 `json:"longitude"`
	Status        string  `json:"status"`
	VehicleStatus string  `json:"vehicle_status"`
	Distance      float64 `json:"distance"`
}

type Driver

type Driver User

func (*Driver) Bind

func (u *Driver) Bind(r *http.Request) error

func (*Driver) CreateDriver

func (u *Driver) CreateDriver(ctx context.Context, db *sql.DB, data *Driver) (bool, error)

func (*Driver) DeleteDriver

func (u *Driver) DeleteDriver(ctx context.Context, db *sql.DB, mobile string) (bool, error)

func (*Driver) Exists

func (u *Driver) Exists(ctx context.Context, db *sql.DB, mobile string) int

func (*Driver) GetDriver

func (u *Driver) GetDriver(ctx context.Context, db *sql.DB, mobile string) (*Driver, error)

func (*Driver) GetDriversNearestLocation

func (u *Driver) GetDriversNearestLocation(ctx context.Context, db *sql.DB, lat, lon float64, distance int) ([]DriveListInfo, error)

func (*Driver) UpdateDriver

func (u *Driver) UpdateDriver(ctx context.Context, db *sql.DB, data *Driver) (bool, error)

func (*Driver) UpdateDriverCoords

func (u *Driver) UpdateDriverCoords(ctx context.Context, db *sql.DB, data *Driver) (bool, error)

func (*Driver) UpdateDriverOtp

func (u *Driver) UpdateDriverOtp(ctx context.Context, db *sql.DB, mobile, otp, otpexp string) (bool, error)

func (*Driver) UpdateDriverOtpExpiry

func (u *Driver) UpdateDriverOtpExpiry(ctx context.Context, db *sql.DB, data *Driver) (bool, error)

func (*Driver) UpdateDriverPass

func (u *Driver) UpdateDriverPass(ctx context.Context, db *sql.DB, data *Driver) (bool, error)

func (*Driver) UpdateDriverPassTmp

func (u *Driver) UpdateDriverPassTmp(ctx context.Context, db *sql.DB, data *Driver) (bool, error)

func (*Driver) UpdateDriverStatus

func (u *Driver) UpdateDriverStatus(ctx context.Context, db *sql.DB, status, mobile string) (bool, error)

func (*Driver) UpdateDriverVehicleStatus

func (u *Driver) UpdateDriverVehicleStatus(ctx context.Context, db *sql.DB, status, mobile string, lat, lon float64) (bool, error)

type Location

type Location struct {
	Address   string  `json:"address"`
	Mobile    string  `json:"mobile"`
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Type      string  `json:"type"`
}

func (*Location) Bind

func (u *Location) Bind(r *http.Request) error

type Otp

type Otp struct {
	Mobile string `json:"mobile"`
	Type   string `json:"type"`
	Otp    string `json:"otp"`
}

type User

type User struct {
	ID            int64   `json:"id"`
	Mobile        string  `json:"mobile"`
	Firstname     string  `json:"firstname"`
	Lastname      string  `json:"lastname"`
	Status        string  `json:"status"`
	Pass          string  `json:"pass"`
	Latitude      float64 `json:"latitude"`
	Longitude     float64 `json:"longitude"`
	Created       string  `json:"created"`
	Modified      string  `json:"modified"`
	Type          string  `json:"type"`
	VehicleStatus string  `json:"-"`
	Otp           string  `json:"otp"`
	OtpExpiry     string  `json:"otp_expiry"`
	Logged        int     `json:"logged"`
	OtpExpired    int     `json:"-"`
}

type UserLogin

type UserLogin struct {
	Mobile string `json:"mobile"`
	Pass   string `json:"pass"`
	Hash   string `json:"hash"`
	Type   string `json:"type"`
}

func (*UserLogin) Bind

func (u *UserLogin) Bind(r *http.Request) error

func (*UserLogin) GetUserInfo

func (u *UserLogin) GetUserInfo(ctx context.Context, db *sql.DB, who, mobile string) (*User, error)

func (*UserLogin) SetUserLogStatus

func (u *UserLogin) SetUserLogStatus(ctx context.Context, db *sql.DB, who, mobile string, flag int) bool

type VehicleStatusInfo

type VehicleStatusInfo struct {
	Mobile    string  `json:"mobile"`
	Status    string  `json:"status"`
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

Jump to

Keyboard shortcuts

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