toolkit

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONResponse

type JSONResponse struct {
	Error   bool        `json:"error"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

type Tools

type Tools struct {
	MaxFileSize        int64
	AllowedTypes       []string
	MaxJSONBytes       int
	AllowUnknownFields bool
}

func (*Tools) CreateDirIfNotExist

func (t *Tools) CreateDirIfNotExist(path string) error

func (*Tools) DownloadStaticFile

func (t *Tools) DownloadStaticFile(w http.ResponseWriter, r *http.Request, filePath, displayName string)

func (*Tools) ErrorJSON

func (t *Tools) ErrorJSON(w http.ResponseWriter, err error, status ...int) error

func (*Tools) PushJSONTORemote

func (t *Tools) PushJSONTORemote(uri string, data any, client ...*http.Client) (*http.Response, int, error)

func (*Tools) RandomString

func (t *Tools) RandomString(n int) string

func (*Tools) ReadJSON

func (t *Tools) ReadJSON(w http.ResponseWriter, r *http.Request, data interface{}) error

func (*Tools) Slugify

func (t *Tools) Slugify(s string) (string, error)

func (*Tools) UploadFiles

func (t *Tools) UploadFiles(r *http.Request, uploadDir string, rename ...bool) ([]*UploadedFile, error)

func (*Tools) UploadOneFile

func (t *Tools) UploadOneFile(r *http.Request, uploadDir string, rename ...bool) (*UploadedFile, error)

func (*Tools) WriteJSON

func (t *Tools) WriteJSON(w http.ResponseWriter, status int, data interface{}, headers ...http.Header) error

type UploadedFile

type UploadedFile struct {
	NewFileName      string
	OriginalFileName string
	FileSize         int64
}

Jump to

Keyboard shortcuts

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