util

package
v0.0.0-...-99b79bc Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: MIT Imports: 8 Imported by: 19

Documentation

Index

Constants

View Source
const (
	// HTTP400InvalidRequestData provides a generic message that can be used when HTTP 400 error has to be returned
	HTTP400InvalidRequestData = "invalid request data"
	Http404NoDataFound        = "no data is found"
	// HTTP500ErrorRetrievingData provides a generic error message which indicates that data access layer code has thrown an error
	HTTP500ErrorRetrievingData = "error in retrieving data"
)

Variables

View Source
var JsonRequestDecoder = schema.NewDecoder()

Functions

func DasParseHtmlInputDate

func DasParseHtmlInputDate(input string) time.Time

func DasParseHtmlInputDateTime

func DasParseHtmlInputDateTime(input string) time.Time

func ParseRequestBodyData

func ParseRequestBodyData(r *http.Request, dto interface{}) error

func ParseRequestData

func ParseRequestData(r *http.Request, dto interface{}) error

func RespondJsonResult

func RespondJsonResult(w http.ResponseWriter, status int, message string, data interface{})

Types

type DasController

type DasController struct {
	Name         string
	Description  string
	Method       string
	Endpoint     string
	Handler      http.HandlerFunc
	AllowedRoles []int
}

DasController specifies the description, allowed method, endpoint, handler functions, and roles allowed to access this controller. Controller does not specifies the underlying source of data that it depends on. Instead, create a separate sever for each particular controller, specify the data source inside the server struct and inject data source into controller's HandlerFunc implementation.

type DasControllerGroup

type DasControllerGroup struct {
	Controllers []DasController
}

Jump to

Keyboard shortcuts

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