ginny

package module
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

README

Ginny

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

Installation

cd $GOPATH && go get github.com/gorillazer/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

AppProviderSet

Functions

This section is empty.

Types

type Application

type Application struct {
	Name    string
	Version string
	Option  *Option
	Logger  *zap.Logger
	Ctx     context.Context

	Server *server.Server
	// contains filtered or unexported fields
}

Application

func NewApp

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

NewApp

func (*Application) Start

func (a *Application) Start() error

Start

type Option

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

Option

func NewOption

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

NewOption

type RegistrarFunc added in v0.2.2

type RegistrarFunc func(app *Application) error

RegistrarFunc

Directories

Path Synopsis
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