core

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GIN_KV_ROUTER_VERSION_KEY = "slapi.router_version"
	GIN_KV_ROUTER_NAME_KEY    = "slapi.router_name"
)

Variables

This section is empty.

Functions

func AnnotateRouter

func AnnotateRouter(vrs *VersionedRouterSpec) gin.HandlerFunc

func ErrorHandler

func ErrorHandler() gin.HandlerFunc

func NewFxLogAdapter

func NewFxLogAdapter() fxevent.Logger

func NewPrometheusServer added in v1.0.1

func NewPrometheusServer(lc fx.Lifecycle, shutdown fx.Shutdowner, c *Config)

func NewTracer

func NewTracer(lc fx.Lifecycle) (trace.TracerProvider, error)

func SetupDefaultLoglevel

func SetupDefaultLoglevel()

func SetupServer

func SetupServer(lc fx.Lifecycle, shutdown fx.Shutdowner, router *Core, config *Config) *http.Server

Types

type Config

type Config struct {
	ListenAddr           string
	ListenAddrPrometheus string
	LogLevel             string
}

func GetConfigDefaults

func GetConfigDefaults() *Config

type Core

type Core struct {
	*gin.Engine
	// contains filtered or unexported fields
}

func New

func New(in In) (*Core, error)

type FxLogAdapter

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

func (*FxLogAdapter) LogEvent

func (l *FxLogAdapter) LogEvent(event fxevent.Event)

type In

type In struct {
	fx.In

	Config          *Config
	VersionedRouter []*VersionedRouterSpec `group:"router"`
	CorsConfig      *cors.Config           `optional:"true"`
	OtelTracer      trace.TracerProvider
}

type Middleware

type Middleware interface {
	Middleware(c *gin.Context)
}

type VersionedRouterOut

type VersionedRouterOut struct {
	fx.Out

	Router *VersionedRouterSpec `group:"router"`
}

type VersionedRouterSpec

type VersionedRouterSpec struct {
	Prefix         string
	Version        uint
	RegisterRouter func(group *gin.RouterGroup)
}

Jump to

Keyboard shortcuts

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