restserver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 20 Imported by: 2

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) Start

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

start rest server

func (*Server) Stop

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

type ServerOption

type ServerOption func(*Server)

func WithCustomMiddlewares

func WithCustomMiddlewares(middlewares []gin.HandlerFunc) ServerOption

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
auth
Package auth defines authentication strategy like Basic, Bearer.
Package auth defines authentication strategy like Basic, Bearer.

Jump to

Keyboard shortcuts

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