Documentation ¶
Index ¶
- func HandleError(w http.ResponseWriter, err error)
- func RemoveIndex(s []string, index int) []string
- func RespondJSON[T any](w http.ResponseWriter, status int, payload T) error
- func RespondOK(w http.ResponseWriter, response string) error
- func RespondStatus(w http.ResponseWriter, status int) error
- func RespondText(w http.ResponseWriter, status int, payload string) error
- type API
- type Auth
- type Config
- func (c *Config) CacheHandler(h http.Handler) http.HandlerFunc
- func (c *Config) CreateCsrfToken(sessionID string) (string, error)
- func (c *Config) GetCsrfToken(r *http.Request) (string, error)
- func (c *Config) InitTemplate(custom Tmpl, r *http.Request) Tmpl
- func (c *Config) Redirect(w http.ResponseWriter, r *http.Request, message string) error
- func (c *Config) Respond(w http.ResponseWriter, r *http.Request, t Tmpl) error
- func (c *Config) RespondData(w http.ResponseWriter, r *http.Request, handler string, data any) error
- func (c *Config) RespondErr(w http.ResponseWriter, r *http.Request, handler string, message string) error
- func (c *Config) ValidCsrfToken(r *http.Request) bool
- type DB
- type Error
- type Public
- type StatusError
- type Tmpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleError ¶
func HandleError(w http.ResponseWriter, err error)
func RemoveIndex ¶
func RespondJSON ¶
func RespondJSON[T any](w http.ResponseWriter, status int, payload T) error
func RespondStatus ¶
func RespondStatus(w http.ResponseWriter, status int) error
func RespondText ¶
func RespondText(w http.ResponseWriter, status int, payload string) error
Types ¶
type Config ¶
type Config struct { Addr *string Router *http.ServeMux User *string Password *string CsrfSecret *string CacheTag *string DB DB Domain *string Version *string DBConnection *string Runtime *string River *river.Client[pgx.Tx] }
func (*Config) CacheHandler ¶
func (c *Config) CacheHandler(h http.Handler) http.HandlerFunc
func (*Config) RespondData ¶
func (*Config) RespondErr ¶
type StatusError ¶
func RespondError ¶
func RespondError(args ...interface{}) StatusError
func (StatusError) Error ¶
func (se StatusError) Error() string
func (StatusError) Message ¶
func (se StatusError) Message() string
func (StatusError) Status ¶
func (se StatusError) Status() int
Click to show internal directories.
Click to hide internal directories.