app

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	AppName     string
	ServiceName string
	ServerHost  string
	ServerPort  uint64
	MaxConns    int
	EtcdClient  *clientv3.Client
}

func NewApp

func NewApp(p Conf) App

func (*App) Deregister

func (a *App) Deregister()

func (*App) Register

func (a *App) Register()

func (*App) StartGrpcServer

func (a *App) StartGrpcServer(register func(srv *grpc.Server), opt ...grpc.ServerOption)

func (*App) StartHttpServer

func (a *App) StartHttpServer(handler http.Handler)

type Conf

type Conf struct {
	AppName     string `yaml:"app_name"`
	ServiceName string
	ServerHost  string `yaml:"server_host"`
	ServerPort  uint64 `yaml:"server_port"`
	EtcdAddress string `yaml:"etcd_address"`
	MaxConns    int    `yaml:"max_conns"`
}

func FromEnv

func FromEnv(serviceName string) Conf

func RPCFromEnv

func RPCFromEnv(serviceName string) Conf

type UniqueID added in v0.0.14

type UniqueID struct {
	NodeID int64
	// contains filtered or unexported fields
}

func NewUniqueID added in v0.0.14

func NewUniqueID(p Conf) *UniqueID

func (*UniqueID) GetID added in v0.0.14

func (u *UniqueID) GetID() int64

Jump to

Keyboard shortcuts

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