core

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 ParseConfig

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

ParseConfig creates an instance of needed struct. It is necesary 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 needed struct passing some env.Options. It is necesary 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)

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 Server

type Server struct {
	*echo.Echo
	// contains filtered or unexported fields
}

func NewServer

func NewServer(
	conf ServerConfig,
	controllers ...Controller,
) *Server

func (*Server) Start

func (c *Server) Start(address string) error

type ServerConfig

type ServerConfig struct {
	EchoInstance *echo.Echo
	BaseEndpoint string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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