simple

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2025 License: MIT Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-simple

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogMiddleware

func CreateLogMiddleware() echo.MiddlewareFunc

func ExceptionMiddleware

func ExceptionMiddleware(next echo.HandlerFunc) echo.HandlerFunc

func GetBodyMap

func GetBodyMap(c echo.Context) (map[string]interface{}, error)

func LoadEnv added in v0.1.5

func LoadEnv(s interface{})

func RecoverMiddleware

func RecoverMiddleware(next echo.HandlerFunc) echo.HandlerFunc

Types

type ApiResponse

type ApiResponse struct {
	Success bool              `json:"success"`
	Data    interface{}       `json:"data"`
	Error   *ApiResponseError `json:"error"`
}

func NewErrorResponse

func NewErrorResponse(err error, message string, code int) *ApiResponse

func NewSuccessResponse

func NewSuccessResponse(data interface{}) *ApiResponse

type ApiResponseError

type ApiResponseError struct {
	Code      int    `json:"code"`
	Message   string `json:"message"`
	Exception string `json:"exception"`
}

type CustomValidator

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

func NewValidator

func NewValidator() *CustomValidator

func (*CustomValidator) Validate

func (cv *CustomValidator) Validate(i interface{}) error

type EchoZLogger

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

func NewEchoZLogger

func NewEchoZLogger(zLogger *zerolog.Logger) EchoZLogger

func (EchoZLogger) Debug

func (e EchoZLogger) Debug(i ...interface{})

func (EchoZLogger) Debugf

func (e EchoZLogger) Debugf(format string, args ...interface{})

func (EchoZLogger) Debugj

func (e EchoZLogger) Debugj(j log.JSON)

func (EchoZLogger) Error

func (e EchoZLogger) Error(i ...interface{})

func (EchoZLogger) Errorf

func (e EchoZLogger) Errorf(format string, args ...interface{})

func (EchoZLogger) Errorj

func (e EchoZLogger) Errorj(j log.JSON)

func (EchoZLogger) Fatal

func (e EchoZLogger) Fatal(i ...interface{})

func (EchoZLogger) Fatalf

func (e EchoZLogger) Fatalf(format string, args ...interface{})

func (EchoZLogger) Fatalj

func (e EchoZLogger) Fatalj(j log.JSON)

func (EchoZLogger) GetZLogger

func (e EchoZLogger) GetZLogger() *zerolog.Logger

func (EchoZLogger) Info

func (e EchoZLogger) Info(i ...interface{})

func (EchoZLogger) Infof

func (e EchoZLogger) Infof(format string, args ...interface{})

func (EchoZLogger) Infoj

func (e EchoZLogger) Infoj(j log.JSON)

func (EchoZLogger) Level

func (e EchoZLogger) Level() log.Lvl

func (EchoZLogger) Output

func (e EchoZLogger) Output() io.Writer

func (EchoZLogger) Panic

func (e EchoZLogger) Panic(i ...interface{})

func (EchoZLogger) Panicf

func (e EchoZLogger) Panicf(format string, args ...interface{})

func (EchoZLogger) Panicj

func (e EchoZLogger) Panicj(j log.JSON)

func (EchoZLogger) Prefix

func (e EchoZLogger) Prefix() string

func (EchoZLogger) Print

func (e EchoZLogger) Print(i ...interface{})

func (EchoZLogger) Printf

func (e EchoZLogger) Printf(format string, args ...interface{})

func (EchoZLogger) Printj

func (e EchoZLogger) Printj(j log.JSON)

func (EchoZLogger) SetHeader

func (e EchoZLogger) SetHeader(h string)

func (EchoZLogger) SetLevel

func (e EchoZLogger) SetLevel(v log.Lvl)

func (EchoZLogger) SetOutput

func (e EchoZLogger) SetOutput(w io.Writer)

func (EchoZLogger) SetPrefix

func (e EchoZLogger) SetPrefix(p string)

func (EchoZLogger) Warn

func (e EchoZLogger) Warn(i ...interface{})

func (EchoZLogger) Warnf

func (e EchoZLogger) Warnf(format string, args ...interface{})

func (EchoZLogger) Warnj

func (e EchoZLogger) Warnj(j log.JSON)

type Env

type Env struct {
	Key   string
	Value any
}

func GetEnv

func GetEnv(key string) *Env

func (*Env) AsBool

func (e *Env) AsBool() bool

func (*Env) AsBytes

func (e *Env) AsBytes() []byte

func (*Env) AsFloat64

func (e *Env) AsFloat64() float64

func (*Env) AsInt

func (e *Env) AsInt() int

func (*Env) AsInt64

func (e *Env) AsInt64() int64

func (*Env) AsString

func (e *Env) AsString() string

func (*Env) Default added in v0.1.5

func (e *Env) Default(v interface{}) *Env

func (*Env) GetEnvAsStrings

func (e *Env) GetEnvAsStrings(separator string) []string

type Error

type Error struct {
	HttpCode   int
	ErrorCode  int
	Message    string
	InnerError error
}

func NewBadRequestError

func NewBadRequestError(err error, message string, errCode int) *Error

func NewForbiddenError

func NewForbiddenError(err error, message string, errCode int) *Error

func NewInternalServerError

func NewInternalServerError(err error, message string, errCode int) *Error

func NewNotFoundError

func NewNotFoundError(err error, message string, errCode int) *Error

func NewUnauthorizedError

func NewUnauthorizedError(err error, message string, errCode int) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) ToHTTPError

func (e *Error) ToHTTPError() *echo.HTTPError

type HttpClient

type HttpClient struct {
	Ctx     context.Context
	Method  string
	Url     string
	Headers map[string]string
	Body    interface{}
	Timeout time.Duration
}

func (*HttpClient) Request

func (c *HttpClient) Request(r interface{}) error

Jump to

Keyboard shortcuts

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