controllers

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: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgLoginOkay = "Login successful"
	MsgStatusOK  = "Success"
	MsgStatusNOK = "Error"
)

Variables

This section is empty.

Functions

func WithSvcOptAddress

func WithSvcOptAddress(r string) *config.Option

WithSvcOptAddress opts for port#

func WithSvcOptDbConf

func WithSvcOptDbConf(r driver.DbConnectorConfig) *config.Option

WithSvcOptDbConf opts for db connector

func WithSvcOptHandler

func WithSvcOptHandler(r *ApiHandler) *config.Option

WithSvcOptHandler opts for handler

Types

type APIResponse

type APIResponse struct {
	Code   int
	Status string
	Result interface{} `json:",omitempty"`
}

type ApiHandler

type ApiHandler struct {
}

func (*ApiHandler) CreateBooking

func (api *ApiHandler) CreateBooking(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) CreateCustomer

func (api *ApiHandler) CreateCustomer(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) CreateDriver

func (api *ApiHandler) CreateDriver(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) DeleteCustomer

func (api *ApiHandler) DeleteCustomer(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) DeleteDriver

func (api *ApiHandler) DeleteDriver(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) GetAddress

func (api *ApiHandler) GetAddress(w http.ResponseWriter, r *http.Request)

func (ApiHandler) GetAuthToken

func (api ApiHandler) GetAuthToken(r *http.Request) string

func (*ApiHandler) GetBooking

func (api *ApiHandler) GetBooking(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) GetCustomer

func (api *ApiHandler) GetCustomer(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) GetCustomerCoords

func (api *ApiHandler) GetCustomerCoords(w http.ResponseWriter, r *http.Request, mobile string)

func (*ApiHandler) GetDriver

func (api *ApiHandler) GetDriver(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) GetDriverCoords

func (api *ApiHandler) GetDriverCoords(w http.ResponseWriter, r *http.Request, mobile string)

func (*ApiHandler) GetDriversList

func (api *ApiHandler) GetDriversList(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) GetLocation

func (api *ApiHandler) GetLocation(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) IndexPage

func (api *ApiHandler) IndexPage(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) Login

func (api *ApiHandler) Login(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) Logout

func (api *ApiHandler) Logout(w http.ResponseWriter, r *http.Request)

func (ApiHandler) ReplyErrContent

func (api ApiHandler) ReplyErrContent(w http.ResponseWriter, r *http.Request, code int, msg string)

ReplyErrContent send 204 msg

http.StatusNoContent
http.StatusText(http.StatusNoContent)

func (*ApiHandler) UpdateBooking

func (api *ApiHandler) UpdateBooking(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateBookingCustomerStatus

func (api *ApiHandler) UpdateBookingCustomerStatus(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateBookingDriverStatus

func (api *ApiHandler) UpdateBookingDriverStatus(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateBookingDropTime

func (api *ApiHandler) UpdateBookingDropTime(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateBookingPickupTime

func (api *ApiHandler) UpdateBookingPickupTime(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateCustomer

func (api *ApiHandler) UpdateCustomer(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateCustomerCoords

func (api *ApiHandler) UpdateCustomerCoords(w http.ResponseWriter, r *http.Request, loc models.Location)

func (*ApiHandler) UpdateCustomerOtp

func (api *ApiHandler) UpdateCustomerOtp(w http.ResponseWriter, r *http.Request, otp models.Otp)

func (*ApiHandler) UpdateCustomerPassword

func (api *ApiHandler) UpdateCustomerPassword(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateCustomerStatus

func (api *ApiHandler) UpdateCustomerStatus(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateDriver

func (api *ApiHandler) UpdateDriver(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateDriverCoords

func (api *ApiHandler) UpdateDriverCoords(w http.ResponseWriter, r *http.Request, loc models.Location)

func (*ApiHandler) UpdateDriverOtp

func (api *ApiHandler) UpdateDriverOtp(w http.ResponseWriter, r *http.Request, otp models.Otp)

func (*ApiHandler) UpdateDriverPassword

func (api *ApiHandler) UpdateDriverPassword(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateDriverStatus

func (api *ApiHandler) UpdateDriverStatus(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateLocation

func (api *ApiHandler) UpdateLocation(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateOtp

func (api *ApiHandler) UpdateOtp(w http.ResponseWriter, r *http.Request)

func (*ApiHandler) UpdateVehicleStatus

func (api *ApiHandler) UpdateVehicleStatus(w http.ResponseWriter, r *http.Request)

type Service

type Service struct {
	Router  *chi.Mux
	Address string
	Api     *ApiHandler
	Config  driver.DbConnectorConfig
	DB      *sql.DB
	Context context.Context
}
var ApiService *Service

api global handler

func NewService

func NewService(opts ...*config.Option) (*Service, error)

NewService service new instance

func (*Service) BearerChecker

func (svc *Service) BearerChecker(next http.Handler) http.Handler

BearerChecker check token

func (*Service) MapRoute

func (svc *Service) MapRoute() *chi.Mux

MapRoute route map all endpoints

func (*Service) Run

func (svc *Service) Run()

Run run the http server based on settings

func (*Service) SetContextKeyVal

func (svc *Service) SetContextKeyVal(k, v string) func(next http.Handler) http.Handler

SetContextKeyVal version context

Jump to

Keyboard shortcuts

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