goboot

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "1.0.1"

Functions

func AddPoweredBy

func AddPoweredBy(arg0 interface{})

func BuildJsonWebToken

func BuildJsonWebToken(arg0 interface{}, isRefreshToken bool, claims ...map[string]interface{}) (token string, err error)

@param *JwtSettings|string arg0

func CheckUploadedFile

func CheckUploadedFile(fh *multipart.FileHeader, opts map[string]interface{}) (passed bool, errorTips string)

func ExecuteTimeLogEnabled

func ExecuteTimeLogEnabled() bool

func ExecuteTimeLogLogger

func ExecuteTimeLogLogger(logger ...logx.Logger) logx.Logger

func FiberDtoBind

func FiberDtoBind(ctx *fiber.Ctx, dto interface{}) error

func FiberErrorHandler

func FiberErrorHandler() fiber.ErrorHandler

func FiberGetClientIp

func FiberGetClientIp(ctx *fiber.Ctx) string

func FiberGetFormData

func FiberGetFormData(ctx *fiber.Ctx) map[string]string

func FiberGetHeader

func FiberGetHeader(ctx *fiber.Ctx, name string) string

func FiberGetHeaders

func FiberGetHeaders(ctx *fiber.Ctx) map[string]string

func FiberGetJwt

func FiberGetJwt(ctx *fiber.Ctx) *jwt.Token

func FiberGetMap

func FiberGetMap(ctx *fiber.Ctx, rules ...interface{}) map[string]interface{}

func FiberGetMethod

func FiberGetMethod(ctx *fiber.Ctx) string

func FiberGetQueryParams

func FiberGetQueryParams(ctx *fiber.Ctx) map[string]string

func FiberGetQueryString

func FiberGetQueryString(ctx *fiber.Ctx, urlencode ...bool) string

func FiberGetRawBody

func FiberGetRawBody(ctx *fiber.Ctx) []byte

func FiberGetRequestUrl

func FiberGetRequestUrl(ctx *fiber.Ctx, withQueryString ...bool) string

func FiberGetUploadedFile

func FiberGetUploadedFile(ctx *fiber.Ctx, formFieldName string) *multipart.FileHeader

func FiberMidRequestLog

func FiberMidRequestLog() fiber.Handler

func FiberPathvariable

func FiberPathvariable(ctx *fiber.Ctx, name string, defaultValue ...interface{}) string

func FiberPathvariableBool

func FiberPathvariableBool(ctx *fiber.Ctx, name string, defaultValue ...interface{}) bool

func FiberPathvariableFloat32

func FiberPathvariableFloat32(ctx *fiber.Ctx, name string, defaultValue ...interface{}) float32

func FiberPathvariableFloat64

func FiberPathvariableFloat64(ctx *fiber.Ctx, name string, defaultValue ...interface{}) float64

func FiberPathvariableInt

func FiberPathvariableInt(ctx *fiber.Ctx, name string, defaultValue ...interface{}) int

func FiberPathvariableInt64

func FiberPathvariableInt64(ctx *fiber.Ctx, name string, defaultValue ...interface{}) int64

func FiberReqParam

func FiberReqParam(ctx *fiber.Ctx, name string, mode int, defaultValue ...interface{}) string

func FiberReqParamBool

func FiberReqParamBool(ctx *fiber.Ctx, name string, defaultValue ...interface{}) bool

func FiberReqParamFloat32

func FiberReqParamFloat32(ctx *fiber.Ctx, name string, defaultValue ...interface{}) float32

func FiberReqParamFloat64

func FiberReqParamFloat64(ctx *fiber.Ctx, name string, defaultValue ...interface{}) float64

func FiberReqParamInt

func FiberReqParamInt(ctx *fiber.Ctx, name string, defaultValue ...interface{}) int

func FiberReqParamInt64

func FiberReqParamInt64(ctx *fiber.Ctx, name string, defaultValue ...interface{}) int64

func FiberSendOutput

func FiberSendOutput(ctx *fiber.Ctx, payload ResponsePayload, err error) error

func GetJwtPrivateKeyPemFile

func GetJwtPrivateKeyPemFile() string

func GetJwtPublicKeyPemFile

func GetJwtPublicKeyPemFile() string

func GinDtoBind

func GinDtoBind(ctx *gin.Context, dto interface{}) error

func GinGetClientIp

func GinGetClientIp(ctx *gin.Context) string

func GinGetFormData

func GinGetFormData(ctx *gin.Context) map[string]string

func GinGetHeader

func GinGetHeader(ctx *gin.Context, name string) string

func GinGetHeaders

func GinGetHeaders(ctx *gin.Context) map[string]string

func GinGetJwt

func GinGetJwt(ctx *gin.Context) *jwt.Token

func GinGetMap

func GinGetMap(ctx *gin.Context, rules ...interface{}) map[string]interface{}

func GinGetMethod

func GinGetMethod(ctx *gin.Context) string

func GinGetQueryParams

func GinGetQueryParams(ctx *gin.Context) map[string]string

func GinGetQueryString

func GinGetQueryString(ctx *gin.Context, urlencode ...bool) string

func GinGetRawBody

func GinGetRawBody(ctx *gin.Context) []byte

func GinGetRequestUrl

func GinGetRequestUrl(ctx *gin.Context, withQueryString ...bool) string

func GinGetUploadedFile

func GinGetUploadedFile(ctx *gin.Context, formFieldName string) *multipart.FileHeader

func GinMidRecover

func GinMidRecover() gin.HandlerFunc

func GinMidRequestBody

func GinMidRequestBody() gin.HandlerFunc

func GinMidRequestLog

func GinMidRequestLog() gin.HandlerFunc

func GinPathvariable

func GinPathvariable(ctx *gin.Context, name string, defaultValue ...interface{}) string

func GinPathvariableBool

func GinPathvariableBool(ctx *gin.Context, name string, defaultValue ...interface{}) bool

func GinPathvariableFloat32

func GinPathvariableFloat32(ctx *gin.Context, name string, defaultValue ...interface{}) float32

func GinPathvariableFloat64

func GinPathvariableFloat64(ctx *gin.Context, name string, defaultValue ...interface{}) float64

func GinPathvariableInt

func GinPathvariableInt(ctx *gin.Context, name string, defaultValue ...interface{}) int

func GinPathvariableInt64

func GinPathvariableInt64(ctx *gin.Context, name string, defaultValue ...interface{}) int64

func GinReqParam

func GinReqParam(ctx *gin.Context, name string, mode int, defaultValue ...interface{}) string

func GinReqParamBool

func GinReqParamBool(ctx *gin.Context, name string, defaultValue ...interface{}) bool

func GinReqParamFloat32

func GinReqParamFloat32(ctx *gin.Context, name string, defaultValue ...interface{}) float32

func GinReqParamFloat64

func GinReqParamFloat64(ctx *gin.Context, name string, defaultValue ...interface{}) float64

func GinReqParamInt

func GinReqParamInt(ctx *gin.Context, name string, defaultValue ...interface{}) int

func GinReqParamInt64

func GinReqParamInt64(ctx *gin.Context, name string, defaultValue ...interface{}) int64

func GinSendOutput

func GinSendOutput(ctx *gin.Context, payload ResponsePayload, err error)

func JwtAuthCheck

func JwtAuthCheck(arg0 interface{}, settingsKey string) error

func JwtClaim

func JwtClaim(arg0 interface{}, name string, defaultValue ...interface{}) string

@param *jwt.Token|*fiber.Ctx|string arg0

func JwtClaimBool

func JwtClaimBool(arg0 interface{}, name string, defaultValue ...interface{}) bool

@param *jwt.Token|*fiber.Ctx|string arg0

func JwtClaimFloat32

func JwtClaimFloat32(arg0 interface{}, name string, defaultValue ...interface{}) float32

@param *jwt.Token|*fiber.Ctx|string arg0

func JwtClaimFloat64

func JwtClaimFloat64(arg0 interface{}, name string, defaultValue ...interface{}) float64

@param *jwt.Token|*fiber.Ctx|string arg0

func JwtClaimInt

func JwtClaimInt(arg0 interface{}, name string, defaultValue ...interface{}) int

@param *jwt.Token|*fiber.Ctx|string arg0

func JwtClaimInt64

func JwtClaimInt64(arg0 interface{}, name string, defaultValue ...interface{}) int64

@param *jwt.Token|*fiber.Ctx|string arg0

func JwtClaimIntSlice

func JwtClaimIntSlice(arg0 interface{}, name string) []int

@param *jwt.Token|*fiber.Ctx|string arg0

func JwtClaimStringSlice

func JwtClaimStringSlice(arg0 interface{}, name string) []string

@param *jwt.Token|*fiber.Ctx|string arg0

func LogExecuteTime

func LogExecuteTime(arg0 interface{})

func LogRequestBody

func LogRequestBody(flag ...bool) bool

func NewFilePart

func NewFilePart(formFieldName, clientFileName, fpath string) filePart

noinspection GoExportedFuncWithUnexportedType

func NewFilePartFromBuffer

func NewFilePartFromBuffer(formFieldName, clientFileName string, buf []byte) filePart

noinspection GoExportedFuncWithUnexportedType

func NewHttpClient

func NewHttpClient(requestUrl string) httpClient

noinspection GoExportedFuncWithUnexportedType

func NewJwtAuthErrorHandler

func NewJwtAuthErrorHandler() *jwtAuthErrorHandler

func NewNoopLogger

func NewNoopLogger() *noopLogger

func NewNormalPart

func NewNormalPart(data map[string]string) normalPart

noinspection GoExportedFuncWithUnexportedType

func NewRateLimitErrorHandler

func NewRateLimitErrorHandler() *rateLimitErrorHandler

func NewValidateErrorHandler

func NewValidateErrorHandler() *validateErrorHandler

func ParseJsonWebToken

func ParseJsonWebToken(token string, pubpem ...string) (*jwt.Token, error)

func RateLimitCheck

func RateLimitCheck(arg0 interface{}, handlerName string, settings interface{}) error

func RatelimiterCacheDir

func RatelimiterCacheDir() string

func RatelimiterLuaFile

func RatelimiterLuaFile() string

func ReplaceBuiltinErrorHandler

func ReplaceBuiltinErrorHandler(errName string, handler ErrorHandler)

func RequestLogEnabled

func RequestLogEnabled() bool

func RequestLogLogger

func RequestLogLogger(logger ...logx.Logger) logx.Logger

func RuntimeLogger

func RuntimeLogger(logger ...logx.Logger) logx.Logger

func ValidateCheck

func ValidateCheck(arg0 interface{}, settings interface{}) error

func VerifyJsonWebToken

func VerifyJsonWebToken(arg0 interface{}, settings *JwtSettings) int

@param *jwt.Token|string arg0

func WithBuiltinErrorHandlers

func WithBuiltinErrorHandlers()

func WithCorsSettings

func WithCorsSettings(settings ...map[string]interface{})

func WithErrorHandler

func WithErrorHandler(handler ErrorHandler)

func WithErrorHandlers

func WithErrorHandlers(handlers []ErrorHandler)

func WithJwtPrivateKeyPemFile

func WithJwtPrivateKeyPemFile(fpath string)

func WithJwtPublicKeyPemFile

func WithJwtPublicKeyPemFile(fpath string)

func WithJwtSettings

func WithJwtSettings(key string, settings ...map[string]interface{})

func WithRatelimiterCacheDir

func WithRatelimiterCacheDir(dir string)

func WithRatelimiterLuaFile

func WithRatelimiterLuaFile(fpath string)

Types

type AttachmentResponse

type AttachmentResponse struct {
	// contains filtered or unexported fields
}

func NewAttachmentResponseFromBuffer

func NewAttachmentResponseFromBuffer(buf []byte, attachmentFileName string, mimeType ...string) AttachmentResponse

func NewAttachmentResponseFromFile

func NewAttachmentResponseFromFile(fpath, attachmentFileName string, mimeType ...string) AttachmentResponse

func (AttachmentResponse) AddSpecifyHeaders

func (p AttachmentResponse) AddSpecifyHeaders(arg0 interface{})

func (AttachmentResponse) Buffer

func (p AttachmentResponse) Buffer() []byte

func (AttachmentResponse) GetContentType

func (p AttachmentResponse) GetContentType() string

func (AttachmentResponse) GetContents

func (p AttachmentResponse) GetContents() (int, string)

type CorsSettings

type CorsSettings struct {
	// contains filtered or unexported fields
}

func GetCorsSettings

func GetCorsSettings() *CorsSettings

func NewCorsSettings

func NewCorsSettings(settings map[string]interface{}) *CorsSettings

func (*CorsSettings) AllowCredentials

func (st *CorsSettings) AllowCredentials() bool

func (*CorsSettings) AllowedHeaders

func (st *CorsSettings) AllowedHeaders() []string

func (*CorsSettings) AllowedMethods

func (st *CorsSettings) AllowedMethods() []string

func (*CorsSettings) AllowedOrigins

func (st *CorsSettings) AllowedOrigins() []string

func (*CorsSettings) ExposedHeaders

func (st *CorsSettings) ExposedHeaders() []string

func (*CorsSettings) MaxAge

func (st *CorsSettings) MaxAge() time.Duration

type ErrorHandler

type ErrorHandler interface {
	GetErrorName() string
	MatchError(err error) bool
	HandleError(err error) ResponsePayload
}

func ErrorHandlers

func ErrorHandlers() []ErrorHandler

type HtmlResponse

type HtmlResponse struct {
	// contains filtered or unexported fields
}

func NewHtmlResponse

func NewHtmlResponse(contents string) HtmlResponse

func (HtmlResponse) GetContentType

func (p HtmlResponse) GetContentType() string

func (HtmlResponse) GetContents

func (p HtmlResponse) GetContents() (int, string)

type HttpErrorResponse

type HttpErrorResponse struct {
	// contains filtered or unexported fields
}

func NewHttpErrorResponse

func NewHttpErrorResponse(statusCode int) HttpErrorResponse

func (HttpErrorResponse) GetContentType

func (p HttpErrorResponse) GetContentType() string

func (HttpErrorResponse) GetContents

func (p HttpErrorResponse) GetContents() (int, string)

type ImageInfoGetFunc

type ImageInfoGetFunc func(fh *multipart.FileHeader) map[string]interface{}

type ImageResponse

type ImageResponse struct {
	// contains filtered or unexported fields
}

func NewImageResponseFromBuffer

func NewImageResponseFromBuffer(buf []byte, mimeType ...string) ImageResponse

func NewImageResponseFromFile

func NewImageResponseFromFile(fpath string, mimeType ...string) ImageResponse

func (ImageResponse) Buffer

func (p ImageResponse) Buffer() []byte

func (ImageResponse) GetContentType

func (p ImageResponse) GetContentType() string

func (ImageResponse) GetContents

func (p ImageResponse) GetContents() (int, string)

type JsonResponse

type JsonResponse struct {
	// contains filtered or unexported fields
}

func NewJsonResponse

func NewJsonResponse(payload interface{}) JsonResponse

func (JsonResponse) GetContentType

func (p JsonResponse) GetContentType() string

func (JsonResponse) GetContents

func (p JsonResponse) GetContents() (statusCode int, contents string)

type JwtAuthError

type JwtAuthError struct {
	// contains filtered or unexported fields
}

func NewJwtAuthError

func NewJwtAuthError(errno int) JwtAuthError

func (JwtAuthError) Errno

func (ex JwtAuthError) Errno() int

func (JwtAuthError) Error

func (ex JwtAuthError) Error() string

type JwtSettings

type JwtSettings struct {
	// contains filtered or unexported fields
}

func GetJwtSettings

func GetJwtSettings(key string) *JwtSettings

func NewJwtSettings

func NewJwtSettings(settings map[string]interface{}) *JwtSettings

func (*JwtSettings) Issuer

func (st *JwtSettings) Issuer() string

func (*JwtSettings) PrivateKeyPemFile

func (st *JwtSettings) PrivateKeyPemFile() string

func (*JwtSettings) PublicKeyPemFile

func (st *JwtSettings) PublicKeyPemFile() string

func (*JwtSettings) RefreshTokenTtl

func (st *JwtSettings) RefreshTokenTtl() time.Duration

func (*JwtSettings) Ttl

func (st *JwtSettings) Ttl() time.Duration

type RateLimitError

type RateLimitError struct {
	// contains filtered or unexported fields
}

func NewRateLimitError

func NewRateLimitError(data map[string]interface{}) RateLimitError

func (RateLimitError) AddSpecifyHeaders

func (ex RateLimitError) AddSpecifyHeaders(arg0 interface{})

func (RateLimitError) Error

func (ex RateLimitError) Error() string

func (RateLimitError) Remaining

func (ex RateLimitError) Remaining() int

func (RateLimitError) RetryAfter

func (ex RateLimitError) RetryAfter() string

func (RateLimitError) Total

func (ex RateLimitError) Total() int

type ResponsePayload

type ResponsePayload interface {
	GetContentType() string
	GetContents() (int, string)
}

type ValidateError

type ValidateError struct {
	// contains filtered or unexported fields
}

func NewValidateError

func NewValidateError(args ...interface{}) ValidateError

func (ValidateError) Error

func (ex ValidateError) Error() string

func (ValidateError) Failfast

func (ex ValidateError) Failfast() bool

func (ValidateError) ValidateErrors

func (ex ValidateError) ValidateErrors() map[string]string

type XmlResponse

type XmlResponse struct {
	// contains filtered or unexported fields
}

func NewXmlResponse

func NewXmlResponse(contents string) XmlResponse

func (XmlResponse) GetContentType

func (p XmlResponse) GetContentType() string

func (XmlResponse) GetContents

func (p XmlResponse) GetContents() (int, string)

Jump to

Keyboard shortcuts

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