Documentation ¶
Index ¶
- func ArrayIn[T comparable](val T, array []T) (exists bool, index int)
- func Color(str string) string
- func Colorf(format string, a ...any) string
- func CreateJPGImage(img *image.RGBA, quality int) ([]byte, error)
- func CreatePNGImage(img *image.RGBA) ([]byte, error)
- func CreatePNGImageURI(img *image.RGBA) (string, error)
- func GenerateUID(alphabet string, size int) (string, error)
- func HttpJsonRequest(w http.ResponseWriter, r *http.Request, res any) error
- func HttpJsonResponse(w http.ResponseWriter, code int, res any)
- func HttpRequestGET(url string) (string, error)
- func HttpSuccess(w http.ResponseWriter, res ...any) error
- func JsonStringAutoDecode(m any) func(rf reflect.Kind, rt reflect.Kind, data any) (any, error)
- func NewUID(param ...int) (string, error)
- func Unmarshal(in any, raw []byte, callback func() error) error
- func Unzip(zipPath, target string) error
- func Zip(source, zipPath string) error
- type Generator
- type HTTPError
- func HttpBadRequest(res ...string) *HTTPError
- func HttpError(code int, res ...string) *HTTPError
- func HttpForbidden(res ...string) *HTTPError
- func HttpInternalServerError(res ...string) *HTTPError
- func HttpNotFound(res ...string) *HTTPError
- func HttpUnauthorized(res ...string) *HTTPError
- func HttpUnprocessableEntity(res ...string) *HTTPError
- func (e *HTTPError) Cause() error
- func (e *HTTPError) Error() string
- func (e *HTTPError) Msg(str string) *HTTPError
- func (e *HTTPError) Msgf(fmtSt string, args ...any) *HTTPError
- func (e *HTTPError) WithInternalErr(err error) *HTTPError
- func (e *HTTPError) WithInternalMsg(msg string) *HTTPError
- func (e *HTTPError) WithInternalMsgf(fmtStr string, args ...any) *HTTPError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayIn ¶
func ArrayIn[T comparable](val T, array []T) (exists bool, index int)
func GenerateUID ¶
GenerateUID is a low-level function to change alphabet and ID size.
func HttpJsonRequest ¶
func HttpJsonResponse ¶
func HttpJsonResponse(w http.ResponseWriter, code int, res any)
func HttpRequestGET ¶
func HttpSuccess ¶
func HttpSuccess(w http.ResponseWriter, res ...any) error
func JsonStringAutoDecode ¶
Types ¶
type HTTPError ¶
type HTTPError struct { Code int `json:"code"` Message string `json:"message"` InternalErr error `json:"-"` InternalMsg string `json:"-"` }
HTTPError is an error with a message and an HTTP status code.
func HttpBadRequest ¶
func HttpForbidden ¶
func HttpInternalServerError ¶
func HttpNotFound ¶
func HttpUnauthorized ¶
func HttpUnprocessableEntity ¶
func (*HTTPError) WithInternalErr ¶
WithInternalErr adds internal error information to the error
func (*HTTPError) WithInternalMsg ¶
WithInternalMsg adds internal message information to the error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.