Documentation ¶
Index ¶
- Constants
- Variables
- func DecryptReflectValue(value reflect.Value) (err error)
- func EncryptReflectValue(value reflect.Value) (err error)
- func ErrorJSON(msg string) (out string)
- func HandleMiddlewares(handlerFunc http.HandlerFunc, ...) (h http.HandlerFunc)
- func MiddlewareCORS(fn http.HandlerFunc) http.HandlerFunc
- func MiddlewareLogger(fn http.HandlerFunc) http.HandlerFunc
- func MiddlewareNoCache(fn http.HandlerFunc) http.HandlerFunc
- func MiddlewareSecure(fn http.HandlerFunc) http.HandlerFunc
- func PasswordHashReflectValue(value reflect.Value) (err error)
- func SetDefaultValue(value reflect.Value, defaultStr string) (err error)
- func Transform(in interface{}) (err error)
- func TransformString(param string, value reflect.Value) (err error)
- func Unmarshal(r *http.Request, dst interface{}) (err error)
- func Validate(in interface{}) (msg string, err error)
- func ValidateFloat64(param string, in float64) (msg string)
- func ValidateInt(param string, in int) (msg string)
- func ValidateString(param, in string) (msg string)
- func WriteJSON(out interface{}, w http.ResponseWriter)
Constants ¶
View Source
const ( TagNameValidate = "validate" TagNameTransform = "transform" TagNameJSON = "json" TransformStrEncrypt = "encrypt" TransformStrDecrypt = "decrypt" TransformStrHash = "hash" TransformStrPasswordHash = "passwordhash" TransformStrTruncate = "truncate" TransformStrTrimChars = "trimchars" TransformStrTrimSpace = "trimspace" TransformStrDefault = "default" ValidateStrMaxLength = "maxlength" ValidateStrMinLength = "minlength" ValidateStrGreaterThan = "greaterthan" ValidateStrLessThan = "lessthan" ValidateStrRequired = "required" ValidateStrMustHaveChars = "musthavechars" ValidateStrCantHaveChars = "canthavechars" ValidateStrOnlyHaveChars = "onlyhavechars" ValidateStrMaxLengthErr = "Failed Max Length Validation" ValidateStrMinLengthErr = "Failed Min Length Validation" ValidateStrRequiredErr = "Failed Required Validation" ValidateStrMustHaveCharsErr = "Failed Must Have Chars Validation" ValidateStrCantHaveCharsErr = "Failed Can't Have Chars Validation" ValidateStrOnlyHaveCharsErr = "Failed Only Have Chars Validation" ValidateStrGreaterThanErr = "Failed Greater Than Validation" ValidateStrLessThanErr = "Failed Less Than Validation" )
Variables ¶
View Source
var ( TypeOfString = reflect.TypeOf(dummyString) TypeOfInt = reflect.TypeOf(dummyInt) TypeOfInt64 = reflect.TypeOf(dummyInt64) TypeOfFloat32 = reflect.TypeOf(dummyFloat32) TypeOfFloat64 = reflect.TypeOf(dummyFloat64) TypeOfBool = reflect.TypeOf(dummyBool) TypeOfStringP = reflect.TypeOf(dummyStringP) TypeOfIntP = reflect.TypeOf(dummyIntP) TypeOfInt64P = reflect.TypeOf(dummyInt64P) TypeOfFloat32P = reflect.TypeOf(dummyFloat32P) TypeOfFloat64P = reflect.TypeOf(dummyFloat64P) TypeOfBoolP = reflect.TypeOf(dummyBoolP) )
View Source
var CORSOrigins = []string{
"http://localhost",
"http://127.0.0.1",
"http://www.example.com",
"https://localhost",
"https://127.0.0.1",
"https://www.example.com",
}
Functions ¶
func DecryptReflectValue ¶
func EncryptReflectValue ¶
func HandleMiddlewares ¶
func HandleMiddlewares(handlerFunc http.HandlerFunc, middlewares ...func(http.HandlerFunc) http.HandlerFunc) (h http.HandlerFunc)
Usage: HandleMiddlewares(PersonHandlerGET, MiddlewareNoCache, MiddlewareCORS)(w, r)
func MiddlewareCORS ¶
func MiddlewareCORS(fn http.HandlerFunc) http.HandlerFunc
func MiddlewareLogger ¶
func MiddlewareLogger(fn http.HandlerFunc) http.HandlerFunc
func MiddlewareNoCache ¶
func MiddlewareNoCache(fn http.HandlerFunc) http.HandlerFunc
func MiddlewareSecure ¶
func MiddlewareSecure(fn http.HandlerFunc) http.HandlerFunc
Influenced by: https://github.com/unrolled/secure
func ValidateFloat64 ¶
func ValidateInt ¶
func ValidateString ¶
func WriteJSON ¶
func WriteJSON(out interface{}, w http.ResponseWriter)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.