Documentation ¶
Index ¶
- Constants
- Variables
- func Application(interrupt InterruptChannel, app ApplicationFunc) (func(), error)
- func Base64Decode(src string) (dst []byte, err error)
- func Base64Encode(src []byte) (dst string)
- func CloneStruct(src, dest interface{}) error
- func Config(opts ConfigOpts, configFunc ConfigFunc) error
- func DateRangeValidation(fl validator.FieldLevel) bool
- func DateValidation(fl validator.FieldLevel) bool
- func DatetimeValidation(fl validator.FieldLevel) bool
- func Debug(msg string, fields ...interface{})
- func Debugf(msg string, args ...interface{})
- func DefaultClient(duration int) *http.Client
- func DefaultPooledTransport(duration int) *http.Transport
- func DefaultTransport(duration int) *http.Transport
- func Error(msg string)
- func Errorf(msg string, args ...interface{})
- func Fatal(msg string, fields ...interface{})
- func Field(key string, value interface{}) interface{}
- func GRPCkommen() string
- func GenerateChar(length int) string
- func HashPassword(password, salt string) string
- func Info(msg string, fields ...interface{})
- func Infof(msg string, args ...interface{})
- func Instance() *zapLog
- func Logger() func(next http.Handler) http.Handler
- func NewZap(c Core) *zapLog
- func NewZapProductionEncoderConfig() zapcore.EncoderConfig
- func Panic(msg string, fields ...interface{})
- func ParseDate(dtStr string) time.Time
- func ParseDatetime(dtStr string) time.Time
- func ParseTagPayment(fl validator.FieldLevel) bool
- func PassLibBase64Decode(src string) (dst []byte, err error)
- func PassLibBase64Encode(src []byte) (dst string)
- func Recovery() func(next http.Handler) http.Handler
- func Redirect(w http.ResponseWriter, r *http.Request, url string)
- func RenderReader(r *http.Request) interface{}
- func RenderWriter(r *http.Request, value interface{})
- func SemanticVersion(r *http.Request, label string, version string)
- func Status(w http.ResponseWriter, r *http.Request, status int, v *Respond) *responseWriter
- func StatusCode(code int) string
- func StatusText(code int) string
- func ToCamel(s string) string
- func Tracer(service, version string, logger Logging) (opentracing.Tracer, func(), error)
- func TracerServer(tracer opentracing.Tracer, operationName string) func(next http.Handler) http.Handler
- func TracerSpanCallback(ctx context.Context, operation string, f func(span context.Context) error) error
- func ULID() ulid.ULID
- func UUID() string
- func VerifyPassword(hashpassword, password string) (bool, error)
- func Warn(msg string, fields ...interface{})
- func Warnf(msg string, args ...interface{})
- func Welkommen() string
- type AppRunner
- type ApplicationFunc
- type CircuitBreaker
- type ConfigConstants
- type ConfigFunc
- type ConfigOpts
- type Core
- type ErrorValidator
- type GRPCCallback
- type GRPCOpts
- type GRPCPort
- type GRPCRunFunc
- type Https
- type InterruptChannel
- type LogFactory
- type Logging
- type MediaType
- type Meta
- type Pagination
- type Respond
- func (r *Respond) APIStatusAccepted(w http.ResponseWriter, req *http.Request) *responseWriter
- func (r *Respond) APIStatusBadGatewayError(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusBadRequest(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusCreated(w http.ResponseWriter, req *http.Request) *responseWriter
- func (r *Respond) APIStatusForbidden(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusGatewayTimeoutError(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusInternalError(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusInvalidAuthentication(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusMethodNotAllowed(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusNotAcceptable(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusPaymentRequired(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusPermanentRedirect(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusRequestTimeout(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusServiceUnavailableError(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusSuccess(w http.ResponseWriter, req *http.Request) *responseWriter
- func (r *Respond) APIStatusUnProcess(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusUnauthorized(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) APIStatusUnsupportedMediaType(w http.ResponseWriter, req *http.Request, err error) *responseWriter
- func (r *Respond) Body(body interface{})
- func (r *Respond) Errors(err ...Meta) *Respond
- func (r *Respond) Page(p Pagination)
- func (r *Respond) Success(code int) *Respond
- type ServeOpts
- type ServerRunFunc
- type Version
- type WebPort
- type WebTimeOut
- type ZapField
Constants ¶
const ( RecommendedRoundsSHA1 = 131000 RecommendedRoundsSHA256 = 29000 RecommendedRoundsSHA512 = 25000 )
const ( // 2xx StatusSuccess = http.StatusOK StatusCreated = http.StatusCreated StatusAccepted = http.StatusAccepted // 3xx StatusPermanentRedirect = http.StatusPermanentRedirect // 4xx StatusBadRequest = http.StatusBadRequest StatusPaymentRequired = http.StatusPaymentRequired StatusForbidden = http.StatusForbidden StatusMethodNotAllowed = http.StatusMethodNotAllowed StatusNotAcceptable = http.StatusNotAcceptable StatusInvalidAuthentication = http.StatusProxyAuthRequired StatusRequestTimeout = http.StatusRequestTimeout StatusUnsupportedMediaType = http.StatusUnsupportedMediaType StatusUnProcess = http.StatusUnprocessableEntity //5xx StatusInternalError = http.StatusInternalServerError StatusBadGatewayError = http.StatusBadGateway StatusGatewayTimeoutError = http.StatusGatewayTimeout )
Variables ¶
var ( NotPointer = errors.New("must pass a pointer, not a value") NilPointer = errors.New("nil pointer passed") )
var ( CtxResponse = ctxKeyResponse{Name: "context Respond"} CtxVersion = ctxKeyVersion{Name: "context version"} )
var (
RenderContext = ctxRender{Name: "context render"}
)
Functions ¶
func Application ¶
func Application(interrupt InterruptChannel, app ApplicationFunc) (func(), error)
func Base64Decode ¶
Base64Encode decodes using a Standard of base64. return string base64 encode
func Base64Encode ¶
Base64Encode encodes using a Standard of base64. return string base64 encode
func CloneStruct ¶
func CloneStruct(src, dest interface{}) error
func Config ¶
func Config(opts ConfigOpts, configFunc ConfigFunc) error
func DateRangeValidation ¶
func DateRangeValidation(fl validator.FieldLevel) bool
func DateValidation ¶
func DateValidation(fl validator.FieldLevel) bool
func DatetimeValidation ¶
func DatetimeValidation(fl validator.FieldLevel) bool
func DefaultClient ¶
func DefaultPooledTransport ¶
func DefaultTransport ¶
func GRPCkommen ¶
func GRPCkommen() string
func GenerateChar ¶
GenerateVoucher Generate Voucher using Alphanumeric except O & 0 return as String
func HashPassword ¶
func NewZapProductionEncoderConfig ¶
func NewZapProductionEncoderConfig() zapcore.EncoderConfig
func ParseDatetime ¶
func ParseTagPayment ¶
func ParseTagPayment(fl validator.FieldLevel) bool
func PassLibBase64Decode ¶
PassLibBase64Decode decodes using a variant of base64, like Passlib. Check https://pythonhosted.org/passlib/lib/passlib.utils.html#passlib.utils.ab64_decode
func PassLibBase64Encode ¶
PassLibBase64Encode encodes using a variant of base64, like Passlib. Check https://pythonhosted.org/passlib/lib/passlib.utils.html#passlib.utils.ab64_encode
func RenderReader ¶
func RenderWriter ¶
func StatusCode ¶
func StatusText ¶
func TracerServer ¶
func TracerSpanCallback ¶
func ULID ¶ added in v1.5.7
func ULID() ulid.ULID
Universally Unique Lexicographically Sortable Identifier
func UUID ¶
func UUID() string
UUID returns a newly initialized string object that implements the UUID interface.
func VerifyPassword ¶
Types ¶
type CircuitBreaker ¶
type CircuitBreaker struct {
// contains filtered or unexported fields
}
func NewBreaker ¶
func NewBreaker(name string, timeout, maxConcurrent int, args ...interface{}) *CircuitBreaker
SetCommandBreaker the circuit breaker
func (*CircuitBreaker) Execute ¶
func (cb *CircuitBreaker) Execute(fn func() error) (err error)
callBreaker command circuit breaker
type ConfigConstants ¶
type ConfigConstants interface{}
type ConfigFunc ¶
type ConfigOpts ¶
type ConfigOpts struct { Config ConfigConstants Filename string Paths []string }
type Core ¶
func DefaultCore ¶
func DefaultCore(out zapcore.WriteSyncer) Core
func ProductionCore ¶
func ProductionCore() Core
type ErrorValidator ¶
type ErrorValidator struct { Type string `json:"error_type,omitempty"` Tag string `json:"error_tag,omitempty"` Field string `json:"error_field,omitempty"` Value string `json:"error_value,omitempty"` Message string `json:"error_message,omitempty"` }
func Validate ¶
func Validate(s interface{}) (errors []ErrorValidator)
type GRPCCallback ¶
type GRPCRunFunc ¶
type GRPCRunFunc func(context.Context, GRPCCallback) error
func RemoteCallProc ¶
func RemoteCallProc(opts GRPCOpts) (GRPCRunFunc, func())
type InterruptChannel ¶
func InterruptChannelFunc ¶
func InterruptChannelFunc() InterruptChannel
type LogFactory ¶
type LogFactory struct {
// contains filtered or unexported fields
}
func (LogFactory) Bg ¶
func (b LogFactory) Bg() Logging
func (LogFactory) With ¶
func (b LogFactory) With(fields ...interface{}) LogFactory
type Logging ¶
type Logging interface { With(fields ...interface{}) Logging Debug(msg string, fields ...interface{}) Debugf(msg string, args ...interface{}) Info(msg string, fields ...interface{}) Infof(msg string, args ...interface{}) Warn(msg string, fields ...interface{}) Warnf(msg string, args ...interface{}) Error(msg string) Errorf(msg string, args ...interface{}) Fatal(msg string, fields ...interface{}) Panic(msg string, fields ...interface{}) Field(key string, value interface{}) interface{} // for type fields }
type Pagination ¶
type Respond ¶ added in v1.5.7
type Respond struct { Version interface{} `json:"version,omitempty"` Meta interface{} `json:"meta,omitempty"` Data interface{} `json:"data,omitempty"` Pagination interface{} `json:"pagination,omitempty"` }
func (*Respond) APIStatusAccepted ¶ added in v1.5.7
func (r *Respond) APIStatusAccepted(w http.ResponseWriter, req *http.Request) *responseWriter
APIStatusAccepted
func (*Respond) APIStatusBadGatewayError ¶ added in v1.5.7
func (r *Respond) APIStatusBadGatewayError(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusBadGatewayError
func (*Respond) APIStatusBadRequest ¶ added in v1.5.7
func (r *Respond) APIStatusBadRequest(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusBadRequest
func (*Respond) APIStatusCreated ¶ added in v1.5.7
func (r *Respond) APIStatusCreated(w http.ResponseWriter, req *http.Request) *responseWriter
APIStatusCreated
func (*Respond) APIStatusForbidden ¶ added in v1.5.7
func (r *Respond) APIStatusForbidden(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusForbidden
func (*Respond) APIStatusGatewayTimeoutError ¶ added in v1.5.7
func (r *Respond) APIStatusGatewayTimeoutError(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusGatewayTimeoutError
func (*Respond) APIStatusInternalError ¶ added in v1.5.7
func (r *Respond) APIStatusInternalError(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusInternalError
func (*Respond) APIStatusInvalidAuthentication ¶ added in v1.5.7
func (r *Respond) APIStatusInvalidAuthentication(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusInvalidAuthentication
func (*Respond) APIStatusMethodNotAllowed ¶ added in v1.5.7
func (r *Respond) APIStatusMethodNotAllowed(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusMethodNotAllowed
func (*Respond) APIStatusNotAcceptable ¶ added in v1.5.7
func (r *Respond) APIStatusNotAcceptable(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusNotAcceptable
func (*Respond) APIStatusPaymentRequired ¶ added in v1.5.7
func (r *Respond) APIStatusPaymentRequired(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusPaymentRequired
func (*Respond) APIStatusPermanentRedirect ¶ added in v1.5.7
func (r *Respond) APIStatusPermanentRedirect(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusPermanentRedirect
func (*Respond) APIStatusRequestTimeout ¶ added in v1.5.7
func (r *Respond) APIStatusRequestTimeout(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusRequestTimeout
func (*Respond) APIStatusServiceUnavailableError ¶ added in v1.5.7
func (r *Respond) APIStatusServiceUnavailableError(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusServiceUnavailableError
func (*Respond) APIStatusSuccess ¶ added in v1.5.7
func (r *Respond) APIStatusSuccess(w http.ResponseWriter, req *http.Request) *responseWriter
APIStatusSuccess for standard request api status success
func (*Respond) APIStatusUnProcess ¶ added in v1.5.7
func (r *Respond) APIStatusUnProcess(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusUnProcess
func (*Respond) APIStatusUnauthorized ¶ added in v1.5.7
func (r *Respond) APIStatusUnauthorized(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusUnauthorized
func (*Respond) APIStatusUnsupportedMediaType ¶ added in v1.5.7
func (r *Respond) APIStatusUnsupportedMediaType(w http.ResponseWriter, req *http.Request, err error) *responseWriter
APIStatusUnsupportedMediaType
func (*Respond) Page ¶ added in v1.5.7
func (r *Respond) Page(p Pagination)
type ServerRunFunc ¶
func ListenAndServe ¶
func ListenAndServe(opts ServeOpts) (ServerRunFunc, func(context.Context))
type WebTimeOut ¶
type WebTimeOut int