ginshared

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 23 Imported by: 4

Documentation

Index

Constants

View Source
const (
	KeyAddress  = "address"
	KeyShutdown = "shutdown"
	KeyInitDB   = "database.initDB"
)

Variables

View Source
var ComponentsOptions = dig.Group("components")
View Source
var ControllerOptions = dig.Group("controllers")

Functions

func CloneRequestBody added in v0.1.14

func CloneRequestBody(c *gin.Context) []byte

func DropDuplicated added in v0.1.10

func DropDuplicated(raw []string) []string

func GetContainer

func GetContainer() *dig.Container

func MD5 added in v0.1.14

func MD5(raw []byte) string

func NewErrorReport added in v0.1.1

func NewErrorReport(replyCode int, logger *zap.Logger) gin.HandlerFunc

func Provide added in v0.2.0

func Provide(constructor interface{}, opts ...dig.ProvideOption) error

func ProvideController added in v0.2.0

func ProvideController(constructor interface{}) error

func RegisterComponent added in v0.6.0

func RegisterComponent(comp Component)

func ReportBadrequest added in v0.1.2

func ReportBadrequest(c *gin.Context, err error)

func RequestLocker added in v0.5.0

func RequestLocker(params ...string) gin.HandlerFunc

func Start

func Start() error

Types

type Component added in v0.6.0

type Component interface {
	Priority() int
	OnEngineInited(r *gin.Engine) error
}

type Components added in v0.6.0

type Components struct {
	Components []Component
}

func (*Components) InitAll added in v0.6.0

func (cs *Components) InitAll(r *gin.Engine)

type CorsComponent added in v0.5.3

type CorsComponent struct {
	DefaultComponent
	Enabled bool
}

func (CorsComponent) OnEngineInited added in v0.5.3

func (c CorsComponent) OnEngineInited(r *gin.Engine) error

type DefaultComponent added in v0.6.0

type DefaultComponent struct{}

func (*DefaultComponent) Priority added in v0.6.0

func (dc *DefaultComponent) Priority() int

type DiController

type DiController interface{}

type ErrorCode added in v0.1.1

type ErrorCode interface {
	ErrorCode() string
}

type GeneralResp added in v0.1.1

type GeneralResp struct {
	Succ         bool
	ErrorCode    string
	ErrorMessage string
}

type ParamComponents added in v0.6.0

type ParamComponents struct {
	dig.In
	Components []Component `group:"components"`
}

type Params

type Params struct {
	dig.In
	Logger      *zap.Logger
	Router      *gin.Engine
	Bus         EventBus.Bus
	Tls         *Tlssettings
	Startups    []core.Startup `group:"startups"`
	Controllers []DiController `group:"controllers"`
}

type Prom added in v0.6.2

type Prom struct {
	DefaultComponent
}

func (Prom) OnEngineInited added in v0.6.2

func (p Prom) OnEngineInited(r *gin.Engine) error

type ReportError added in v0.1.1

type ReportError struct {
	ReplyCode int
	// contains filtered or unexported fields
}

func (*ReportError) Middleware added in v0.1.1

func (handle *ReportError) Middleware(c *gin.Context)

func (*ReportError) RespErrorToClient added in v0.1.1

func (handle *ReportError) RespErrorToClient(c *gin.Context, err interface{})

type Tlssettings added in v0.4.4

type Tlssettings struct {
	Enabled bool
	Pem     string
	Key     string
}

func CheckAndSetupTLS added in v0.4.4

func CheckAndSetupTLS(logger *zap.Logger) (tls *Tlssettings)

func (*Tlssettings) Middleware added in v0.4.4

func (s *Tlssettings) Middleware() gin.HandlerFunc

Jump to

Keyboard shortcuts

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