Documentation ¶
Index ¶
- Constants
- Variables
- func Base64Decode(src string) (dst []byte)
- func Base64Encode(src []byte) (dst string)
- 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 Error(msg string, fields ...interface{})
- func Fatal(msg string, fields ...interface{})
- func Field(key string, value interface{}) interface{}
- func GenerateChar(length int) string
- func HashPassword(password, salt string) string
- func Info(msg string, fields ...interface{})
- func Instance() *zapLog
- 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 PassLibBase64Decode(src string) (dst []byte, err error)
- func PassLibBase64Encode(src []byte) (dst string)
- func Response() *response
- func Status(r *http.Request, status int)
- func StatusCode(code int) string
- func StatusText(code int) string
- func ToCamel(s string) string
- func UUID() string
- func Velkommen() string
- func VerifyPassword(hashpassword, password string) (bool, error)
- func Warn(msg string, fields ...interface{})
- func WriteCSV(w http.ResponseWriter, r *http.Request, rows [][]string, filename string)
- func WriteJSON(w http.ResponseWriter, r *http.Request, v interface{})
- type CircuitBreaker
- type CmdHttp
- type Core
- type Logging
- type Meta
- type Pagination
- type Server
- type ZapField
Constants ¶
const ( RecommendedRoundsSHA1 = 131000 RecommendedRoundsSHA256 = 29000 RecommendedRoundsSHA512 = 25000 )
const ( StatusSuccess = http.StatusOK StatusErrorForm = http.StatusBadRequest StatusErrorUnknown = http.StatusBadGateway StatusInternalError = http.StatusInternalServerError StatusCreated = http.StatusCreated StatusAccepted = http.StatusAccepted StatusForbidden = http.StatusForbidden StatusInvalidAuthentication = http.StatusProxyAuthRequired )
Variables ¶
var CtxResponse = ctxKeyResponse{Name: "context response"}
Functions ¶
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 DateRangeValidation ¶
func DateRangeValidation(fl validator.FieldLevel) bool
func DateValidation ¶
func DateValidation(fl validator.FieldLevel) bool
func DatetimeValidation ¶
func DatetimeValidation(fl validator.FieldLevel) bool
func GenerateChar ¶
GenerateVoucher Generate Voucher using Alphanumeric except O & 0 return as String
func HashPassword ¶
func NewZapProductionEncoderConfig ¶
func NewZapProductionEncoderConfig() zapcore.EncoderConfig
func ParseDatetime ¶
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 StatusCode ¶
func StatusText ¶
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 CmdHttp ¶
type CmdHttp interface { GetCmd() *cobra.Command GRPCHandler(handler *grpc.Server) // contains filtered or unexported methods }
func NewCmdHttp ¶
type Core ¶
func DefaultCore ¶
func DefaultCore(out zapcore.WriteSyncer) Core
func ProductionCore ¶
func ProductionCore() Core
type Logging ¶
type Logging interface { With(fields ...interface{}) Logging Debug(msg string, fields ...interface{}) Info(msg string, fields ...interface{}) Warn(msg string, fields ...interface{}) Error(msg string, fields ...interface{}) Fatal(msg string, fields ...interface{}) Panic(msg string, fields ...interface{}) Field(key string, value interface{}) interface{} // for type fields }
type Meta ¶
type Pagination ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server warps http.Server.
func StartWebServer ¶
StartWebServer starts a web server
func (*Server) StopNotify ¶
func (srv *Server) StopNotify() <-chan struct{}
StopNotify returns receive-only stop channel to notify the server has stopped.