restserver

package
v0.0.0-...-ed26981 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JwtInfo

type JwtInfo struct {
	//defaults to "JWT"
	Realm string
	//defaults to empty
	Key string
	//defaults to 7 days
	Timeout time.Duration
	//defaults to 7 days 刷新时长
	MaxRefresh time.Duration
}

type Server

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

wrapper for gin.Engine

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) ServerName

func (s *Server) ServerName() string

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

start rest server

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

func (*Server) Translator

func (s *Server) Translator() ut.Translator

type ServerOption

type ServerOption func(*Server)

func WithEnableProfiling

func WithEnableProfiling(profiling bool) ServerOption

func WithHealthz

func WithHealthz(healthz bool) ServerOption

func WithJwt

func WithJwt(jwt *JwtInfo) ServerOption

func WithMetrics

func WithMetrics(metrics bool) ServerOption

func WithMiddlewares

func WithMiddlewares(middlewares []string) ServerOption

func WithMode

func WithMode(mode string) ServerOption

func WithPort

func WithPort(port int) ServerOption

func WithServiceName

func WithServiceName(srvName string) ServerOption

func WithTransName

func WithTransName(transName string) ServerOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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