Documentation ¶
Index ¶
- func LoggerMiddleware(logger tools.Logger) func(http.Handler) http.Handler
- func OptionalMiddlewares(active bool, middlewares ...func(http.Handler) http.Handler) func(http.Handler) http.Handler
- type Client
- type HTMLData
- type HTMLResponse
- type PrepareClientFn
- type PrepareRequestFn
- type Response
- type Server
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoggerMiddleware ¶
LoggerMiddleware is a middleware that logs requests and responses middleware uses [DEBUG] level
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(logger tools.Logger, baseURL string, prepare ...PrepareClientFn) (client *Client, err error)
NewClient creates a new client instance
type HTMLData ¶ added in v0.0.5
type HTMLData struct {
// contains filtered or unexported fields
}
func NewHTMLData ¶ added in v0.0.5
type HTMLResponse ¶ added in v0.0.5
type Response ¶
type Response[T any] struct { Success bool `json:"success"` Message string `json:"message,omitempty"` Data T `json:"data,omitempty"` }
Response is a generic response structure
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
type Template ¶ added in v0.0.5
type Template struct {
// contains filtered or unexported fields
}
func NewTemplate ¶ added in v0.0.5
NewTemplate создает новый экземпляр шаблона
func ParseTemplate ¶ added in v0.0.5
func ParseTemplate(log tools.Logger, tmpl *template.Template, dir string, errorTMPL string) (*Template, error)
ParseTemplate парсит шаблоны из директории
func (*Template) Write ¶ added in v0.0.5
func (t *Template) Write(w http.ResponseWriter, code int, data HTMLResponse)
Write записывает шаблон в ответ
Click to show internal directories.
Click to hide internal directories.