core

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const EchoContextTemplWrapperKey = "echoCtx"
View Source
const (
	SessionSecretKey = "session_key"
)

Variables

This section is empty.

Functions

func BindAndValidate

func BindAndValidate(ctx echo.Context, i any) error

func GetFromEchoContext

func GetFromEchoContext[T any](ctx echo.Context, key string) T

func I18nMiddleware added in v0.21.0

func I18nMiddleware(embedLocalizations embed.FS, defaultLocale i18n.Code) echo.MiddlewareFunc

func ParseConfig

func ParseConfig[T any]() (T, error)

ParseConfig creates an instance of the necessary struct. It is necessary the struct contains env and validate tags to be parsed correctly

func ParseConfigWithOptions

func ParseConfigWithOptions[T any](opts env.Options) (T, error)

ParseConfigWithOptions creates an instance of the necessary struct passing some env.Options. It is necessary the struct contains env and validate tags to be parsed correctly

func RegisterController

func RegisterController(group *echo.Group, contr Controller)

func RegisterControllers

func RegisterControllers(group *echo.Group, contrs ...Controller)

func Render added in v0.21.0

func Render(ctx echo.Context, statusCode int, t templ.Component) error

func SessionSecretKeyMiddleware added in v0.21.0

func SessionSecretKeyMiddleware(sessionSecret SessionSecretKeyConfig) echo.MiddlewareFunc

func SetFlash added in v0.21.0

func SetFlash(ctx echo.Context, flash FlashMessage)

func Validate added in v0.21.0

func Validate(ctx echo.Context, i any) error

Types

type Config

type Config struct {
	// Environment is used to get data using ParseConfig
	Environment string `env:"ENVIRONMENT" validate:"required|in:prod,dev,test"`
	Port        int    `env:"PORT" validate:"required|min:1|max:65535"`
}

Config is a struct helper to get all configuration need by winter

type Controller

type Controller interface {
	SetUpRoutes(*echo.Group)
}

type EchoContextTemplWrapper added in v0.21.0

type EchoContextTemplWrapper struct {
	echo.Context
}

func GetEchoTemplContext added in v0.21.0

func GetEchoTemplContext(ctx context.Context) *EchoContextTemplWrapper

func (*EchoContextTemplWrapper) Deadline added in v0.21.0

func (c *EchoContextTemplWrapper) Deadline() (deadline time.Time, ok bool)

func (*EchoContextTemplWrapper) Done added in v0.21.0

func (c *EchoContextTemplWrapper) Done() <-chan struct{}

func (*EchoContextTemplWrapper) Err added in v0.21.0

func (c *EchoContextTemplWrapper) Err() error

func (*EchoContextTemplWrapper) GetCqrfToken added in v0.21.0

func (c *EchoContextTemplWrapper) GetCqrfToken() string

func (*EchoContextTemplWrapper) GetFlash added in v0.21.0

func (c *EchoContextTemplWrapper) GetFlash() []FlashMessage

func (*EchoContextTemplWrapper) Value added in v0.21.0

func (c *EchoContextTemplWrapper) Value(key any) any

type FlashMessage added in v0.21.0

type FlashMessage struct {
	Variant toast.Variant
	Message string
	Title   string
}

type SessionSecretKeyConfig added in v0.21.0

type SessionSecretKeyConfig struct {
	SessionSecretKey string `env:"SESSION_SECRET_KEY" validate:"required"`
}

Directories

Path Synopsis
web
components/datetime
templ: version: v0.3.898
templ: version: v0.3.898
components/formerrors
templ: version: v0.3.898
templ: version: v0.3.898
components/formtag
templ: version: v0.3.898
templ: version: v0.3.898
components/icon
templui component icon - version: main installed by templui v0.70.0
templui component icon - version: main installed by templui v0.70.0
components/link
templ: version: v0.3.898
templ: version: v0.3.898
layouts
templ: version: v0.3.898
templ: version: v0.3.898
utils
templui util templui.go - version: main installed by templui v0.70.0
templui util templui.go - version: main installed by templui v0.70.0

Jump to

Keyboard shortcuts

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