gorg

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GorgFactory

func GorgFactory(c *Config) error

func UrlResolve

func UrlResolve(r Route, m Group, c Config) string

Types

type Config

type Config struct {
	Swagger

	Engine *echo.Echo
	Groups []Group

	Prefix  string
	Version string

	// DisableDefaultMiddlewares bool
	DisabledClearTerminal bool
	ReleaseMode           bool

	HideBanner      bool
	HidePort        bool
	HideInformation bool
}

type GorgMiddleware

type GorgMiddleware string
const (
	Auth    GorgMiddleware = "auth"
	Logger  GorgMiddleware = "logger"
	Recover GorgMiddleware = "recover"
)

type Group

type Group struct {
	Prefix       string
	Version      string
	AuthRequired bool
	Name         string
	Routes       []Route
	Middlewares  []echo.MiddlewareFunc
}

func RegisterGroup

func RegisterGroup(modules ...Group) []Group

type HttpMethod

type HttpMethod string
const (
	GET     HttpMethod = "GET"
	PUT     HttpMethod = "PUT"
	HEAD    HttpMethod = "HEAD"
	POST    HttpMethod = "POST"
	PATCH   HttpMethod = "PATCH"
	TRACE   HttpMethod = "TRACE"
	DELETE  HttpMethod = "DELETE"
	OPTIONS HttpMethod = "OPTIONS"
	CONNECT HttpMethod = "CONNECT"
)

func MethodResolve

func MethodResolve(r Route) []HttpMethod

type Route

type Route struct {
	Prefix       string
	Version      string
	AuthRequired bool

	Doc RouteDoc

	Path    string
	Method  HttpMethod
	Methods []HttpMethod
	Handler func(c echo.Context) error
	Body    any
	Query   any
	Res     any
}

type RouteDoc

type RouteDoc struct {
	Description string
	Summary     string
}

type Swagger

type Swagger struct {
	IsDisabled  bool
	ID          string
	Swagger     string
	Host        string
	BasePath    string
	Title       string
	Description string
}

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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