core

package
v0.0.0-...-b678ff7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTEXT             = "/*ctx.Context"
	WS_CONNECTION       = "/*websocket.Conn"
	REQUEST             = "/*http.Request"
	RESPONSE            = "net/http/http.ResponseWriter"
	BODY                = "github.com/dangduoc08/gogo/ctx/ctx.Body"
	FORM                = "github.com/dangduoc08/gogo/ctx/ctx.Form"
	QUERY               = "github.com/dangduoc08/gogo/ctx/ctx.Query"
	HEADER              = "github.com/dangduoc08/gogo/ctx/ctx.Header"
	PARAM               = "github.com/dangduoc08/gogo/ctx/ctx.Param"
	FILE                = "github.com/dangduoc08/gogo/ctx/ctx.File"
	WS_PAYLOAD          = "github.com/dangduoc08/gogo/ctx/ctx.WSPayload"
	NEXT                = "/func()"
	REDIRECT            = "/func(string)"
	CONTEXT_PIPEABLE    = "context"
	BODY_PIPEABLE       = "body"
	FORM_PIPEABLE       = "form"
	QUERY_PIPEABLE      = "query"
	HEADER_PIPEABLE     = "header"
	PARAM_PIPEABLE      = "param"
	FILE_PIPEABLE       = "file"
	WS_PAYLOAD_PIPEABLE = "wsPayload"
)

link to aliases

Variables

This section is empty.

Functions

func ModuleBuilder

func ModuleBuilder() *moduleBuilder

Types

type App

type App struct {
	Logger common.Logger
	// contains filtered or unexported fields
}

func New

func New() *App

func (*App) BindGlobalExceptionFilters

func (app *App) BindGlobalExceptionFilters(exceptionFilters ...common.ExceptionFilterable) *App

func (*App) BindGlobalGuards

func (app *App) BindGlobalGuards(guarders ...common.Guarder) *App

func (*App) BindGlobalInterceptors

func (app *App) BindGlobalInterceptors(interceptors ...common.Interceptable) *App

func (*App) Create

func (app *App) Create(m *Module)

func (*App) EnableVersioning

func (app *App) EnableVersioning(v versioning.Versioning) *App

func (*App) For

func (app *App) For(route string) func(handlers ...ctx.Handler) *App

func (*App) Get

func (app *App) Get(p Provider) any

func (*App) Listen

func (app *App) Listen(port int) error

func (*App) ServeHTTP

func (app *App) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*App) Use

func (app *App) Use(handlers ...ctx.Handler) *App

func (*App) UseLogger

func (app *App) UseLogger(logger common.Logger) *App

type Controller

type Controller interface {
	NewController() Controller
}

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

func (*Middleware) Apply

func (mw *Middleware) Apply(middleware ctx.Handler, handlers ...any) *Middleware

type Module

type Module struct {
	*sync.Mutex

	Middleware *Middleware
	IsGlobal   bool
	OnInit     func()

	// store REST module middlewares
	RESTMiddlewares []RESTMiddlewareLayer

	// store REST module guards
	RESTGuards []RESTCommonLayer

	// store REST module interceptors
	RESTInterceptors []RESTCommonLayer

	// store REST module exception filters
	RESTExceptionFilters []RESTCommonLayer

	// store REST main handlers
	RESTMainHandlers []RESTCommonLayer

	// store WS module middlewares
	WSMiddlewares []struct {
		Subprotocol string
		EventName   string
		Handlers    []ctx.Handler
		// contains filtered or unexported fields
	}

	// store WS module guards
	WSGuards []struct {
		Subprotocol string
		EventName   string
		Handler     any
	}

	// store WS module interceptors
	WSInterceptors []struct {
		Subprotocol string
		EventName   string
		Handler     any
	}

	// store WS module exception filters
	WSExceptionFilters []struct {
		Subprotocol string
		EventName   string
		Handler     any
	}

	// store WS main handlers
	WSMainHandlers []struct {
		Subprotocol string
		EventName   string
		Handler     any
	}
	// contains filtered or unexported fields
}

func (*Module) ID

func (m *Module) ID() string

func (*Module) NewModule

func (m *Module) NewModule() *Module

func (*Module) Prefix

func (m *Module) Prefix(prefix string) *Module

type Provider

type Provider interface {
	NewProvider() Provider
}

type RESTCommonLayer

type RESTCommonLayer struct {
	Route   string
	Version string
	Method  string
	Handler any
}

type RESTMiddlewareLayer

type RESTMiddlewareLayer struct {
	Route    string
	Version  string
	Method   string
	Handlers []func(*ctx.Context)
	// contains filtered or unexported fields
}

type WSCommonLayer

type WSCommonLayer struct {
	Subprotocol string
	EventName   string
	Handler     any
}

type WSMiddlewareLayer

type WSMiddlewareLayer struct {
	Subprotocol string
	EventName   string
	Handlers    []func(*ctx.Context)
	// contains filtered or unexported fields
}

type WithValueKey

type WithValueKey string

Jump to

Keyboard shortcuts

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