grpcapp

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: MIT Imports: 15 Imported by: 0

README

grpcapp test Coverage Status CodeQL report godoc

A simple wrapper for gRPC microservices.

Features

  • Built-in CLI generator.
  • Tiny and elegant.
  • Includes exactly what's required.

License

The grpcapp package is open-sourced software licensed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start added in v0.0.3

func Start(options ...Option)

Start shortcut to New().Listen().

Types

type App

type App interface {
	Start()
}

App interface.

func New

func New(options ...Option) App

New app generator.

type Config added in v0.0.3

type Config struct {
	DatabaseDSN    string `env:"DATABASE_DSN"`
	LogLevel       string `env:"LOG_LEVEL" envDefault:"info"`
	GrpcListenPort int    `env:"GRPC_LISTEN_PORT" envDefault:"9000"`
	HttpListenPort int    `env:"HTTP_LISTEN_PORT" envDefault:"8080"`
	TLSCertificate string `env:"TLS_CERTIFICATE"`
	TLSKey         string `env:"TLS_KEY"`
}

Config of the application.

type Implementation

type Implementation interface {
	UseTools(Tools)
}

Implementation interface.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option interface.

func WithConfig added in v0.0.3

func WithConfig(cfg *Config) Option

func WithDatabase

func WithDatabase(db *pgx.Conn) Option

func WithGrpcServer added in v0.0.3

func WithGrpcServer(srv *grpc.Server) Option

func WithGrpcServerOptions

func WithGrpcServerOptions(options ...grpc.ServerOption) Option

func WithHTTP added in v0.0.3

func WithHTTP() Option

func WithHttpServer added in v0.0.3

func WithHttpServer(srv *http.Server) Option

func WithLogger

func WithLogger(log *zap.Logger) Option

func WithServiceImplementation

func WithServiceImplementation(desc *grpc.ServiceDesc, impl Implementation) Option

type Tools

type Tools interface {
	Config() *Config
	DB() *pgx.Conn
	Log() *zap.Logger
}

Tools interface.

Directories

Path Synopsis
h

Jump to

Keyboard shortcuts

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