ginny

package module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: BSD-3-Clause Imports: 9 Imported by: 3

README

Ginny

Ginny base on gRPC + gRPC-Gateway, more components to improve development efficiency.

Installation

cd $GOPATH && go get github.com/goriller/ginny-cli/ginny
Dependencies tools
  • protoc

https://github.com/protocolbuffers/protobuf/releases

  • protoc-gen-go:
cd $GOPATH && go install github.com/golang/protobuf/protoc-gen-go@latest
  • go wire:
cd $GOPATH && go get github.com/google/wire/cmd/wire
  • protoc-gen-validate:
cd $GOPATH && go install github.com/envoyproxy/protoc-gen-validate@latest
  • goimports:
cd $GOPATH && go get golang.org/x/tools/cmd/goimports
  • mockgen:
cd $GOPATH && go install github.com/golang/mock/mockgen@v1.6.0
  • make:

Mac OS and Linux systems already have the make command,

windows: How to run "make" command in gitbash in windows?

Quick Start

1.Create Project
ginny new hellodemo
2.modify .proto and generate pb code
make protoc
4. Make

// wire
make wire

How to debug

if you use vscode , edit the .vscode/launch.json , like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch GoPackage",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}/cmd",
            "env": {
            // ...
            },
            "args": [
                "-conf","../configs/dev.yml"
                // "-remote", "etcd://127.0.0.1:1233/test",
            ]
        }
    ]
}

Select Launch GoPackage to debug run. Try to call http://localhost:8080/ or grpc://127.0.0.1:9000/ .

Example

Check out the quick start example.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AppProviderSet
	AppProviderSet = wire.NewSet(
		logger.Default,
		config.ConfigProviderSet,
		NewOption, NewApp,
	)

)

Functions

This section is empty.

Types

type Application

type Application struct {
	Name    string
	Version string
	Option  *Option
	Logger  *zap.Logger
	Server  *server.Server
	Ctx     context.Context
	// contains filtered or unexported fields
}

Application

func NewApp

func NewApp(
	ctx context.Context,
	option *Option,
	logger *zap.Logger,
	regFunc RegistrarFunc,
	opts ...server.Option,
) (*Application, error)

NewApp

func (*Application) Start

func (a *Application) Start(ctx context.Context) error

Start

func (*Application) Stop added in v0.2.12

func (a *Application) Stop(ctx context.Context) error

Stop

type Option

type Option struct {
	Name        string
	Version     string
	GrpcAddr    string
	HttpAddr    string
	MetricsAddr string
}

Option

func NewOption

func NewOption(v *viper.Viper) (*Option, error)

NewOption

type RegistrarFunc

type RegistrarFunc func(app *Application) error

RegistrarFunc

Directories

Path Synopsis
limit
Package routerlimit provide router limit tools
Package routerlimit provide router limit tools
logging
Package logging implements grpc logging middleware.
Package logging implements grpc logging middleware.
mux

Jump to

Keyboard shortcuts

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