tron

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 21 Imported by: 5

README

tron

Installation

install tron: GO111MODULE=off go get -u github.com/loghole/tron/cmd/tron

install protoc:

  • linux
$ apt install -y protobuf-compiler
$ protoc --version
  • mac:
$ brew install protobuf
$ protoc --version

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetName

func SetName(name string)

SetName overrides default the application name.

Types

type App

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

func New

func New(options ...app.Option) (*App, error)

New init viper config, logger and tracer.

func (*App) Info

func (a *App) Info() *Info

func (*App) Logger

func (a *App) Logger() *zap.Logger

func (*App) Router

func (a *App) Router() chi.Router

func (*App) Run

func (a *App) Run(impl ...transport.Service) error

func (*App) TraceLogger

func (a *App) TraceLogger() tracelog.Logger

func (*App) Tracer

func (a *App) Tracer() *tracing.Tracer

func (*App) WithRunOptions

func (a *App) WithRunOptions(opts ...app.RunOption) *App

Append some run options.

type Info

type Info struct {
	InstanceUUID string
	ServiceName  string
	Namespace    string
	AppName      string
	GitHash      string
	Version      string
	BuildAt      string
}

type Option

type Option = app.Option

func AddLogCaller

func AddLogCaller() Option

AddLogCaller configures the Logger to annotate each message with the filename and line number of zap's caller. See also WithCaller.

func AddLogStacktrace

func AddLogStacktrace(level string) Option

AddLogStacktrace configures the Logger to record a stack trace for all messages at or above a given level.

func WithAdminHTTP

func WithAdminHTTP(port uint16) Option

func WithExitSignals

func WithExitSignals(sig ...os.Signal) Option

func WithLogField

func WithLogField(key string, value interface{}) Option

WithLogField adds field to the Logger.

func WithPublicGRPc

func WithPublicGRPc(port uint16) Option

func WithPublicHTTP

func WithPublicHTTP(port uint16) Option

func WithTLSConfig

func WithTLSConfig(config *tls.Config) Option

func WithTLSKeyPair

func WithTLSKeyPair(certFile, keyFile string) Option

type RunOption

type RunOption = app.RunOption

func WithHTTPMiddleware

func WithHTTPMiddleware(middleware func(http.Handler) http.Handler) RunOption

func WithUnaryInterceptor

func WithUnaryInterceptor(interceptor grpc.UnaryServerInterceptor) RunOption

Directories

Path Synopsis
cmd
tron module
example module
internal
app
http/swagger
Package swagger generated by go-bindata.// sources: data/favicon-16x16.png data/favicon-32x32.png data/index.html data/oauth2-redirect.html data/swagger-ui-bundle.js data/swagger-ui-standalone-preset.js data/swagger-ui.css data/swagger-ui.js
Package swagger generated by go-bindata.// sources: data/favicon-16x16.png data/favicon-32x32.png data/index.html data/oauth2-redirect.html data/swagger-ui-bundle.js data/swagger-ui-standalone-preset.js data/swagger-ui.css data/swagger-ui.js

Jump to

Keyboard shortcuts

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