bootstrap

package
v0.0.0-...-92f319c Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogConfig

type LogConfig struct {
	LogGrpc            bool     `yaml:"logGrpc"`            //记录GRPC 框架日志
	OutputPaths        []string `yaml:"outputPaths"`        //日志输出路径
	RotationMaxSize    int      `yaml:"rotationMaxSize"`    // 切割日志大小
	RotationMaxBackups int      `yaml:"rotationMaxBackups"` // 备份多少个
	RotationMaxAge     int      `yaml:"rotationMaxAge"`     //最大时间
	LogLevel           string   `yaml:"logLevel"`
}

type MongoConfig

type MongoConfig struct {
	Hosts       []string `yaml:"hosts"`
	Username    string   `yaml:"username"`
	Password    string   `yaml:"password"`
	AuthSource  string   `yaml:"authSource"`
	MaxPoolSize uint64   `yaml:"maxPoolSize"`
	ReplicaSet  string   `yaml:"replicaSet"`
}

type Option

type Option func(*Options)

func WithMongoDB

func WithMongoDB(is bool) Option

func WithRedis

func WithRedis(is bool) Option

func WithRegister

func WithRegister(is bool) Option

func WithRegisterGrpcCallback

func WithRegisterGrpcCallback(fn func(server *grpc.Server)) Option

func WithServiceName

func WithServiceName(name string) Option

type Options

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

func NewOptions

func NewOptions(opts ...Option) *Options

type PProfConfig

type PProfConfig struct {
	IsEnabled bool   `yaml:"isEnabled"`
	Path      string `yaml:"path"`
	Frequency string `yaml:"frequency"`
}

type RedisConfig

type RedisConfig struct {
	Addr     string `yaml:"addr"`
	Password string `yaml:"password"`
}

type Server

type Server struct {

	// Container is a dependence inject container
	Container *dig.Container
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts ...Option) (s *Server)

func (*Server) Init

func (s *Server) Init(opts ...Option)

func (*Server) NewMongoOptions

func (s *Server) NewMongoOptions() *mongo.Options

func (*Server) NewPProfOptions

func (s *Server) NewPProfOptions() *pprof.Options

func (*Server) NewRedisOptions

func (s *Server) NewRedisOptions() *redis.Options

func (*Server) Run

func (s *Server) Run()

func (*Server) Stop

func (s *Server) Stop()

type ServerConfig

type ServerConfig struct {
	RegistryAddr string `yaml:"registryAddr"`
	Port         int    `yaml:"port"`
}

Jump to

Keyboard shortcuts

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