Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

core

v1.0.8
github.com/pangum/grpc/internal/core

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

14 matches

Top ↑

Types

Client

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

Client gRPC客户端封装

NewClient

func NewClient(connections map[string]*grpc.ClientConn) *Client

Client.Connection

func (c *Client) Connection(name string) *grpc.ClientConn

Gateway

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

NewGateway

func NewGateway(logger log.Logger) *Gateway

Gateway.Status

func (g *Gateway) Status(ctx context.Context, code int)

Handler

type Handler func(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

Handler 端点注册方法

Handlers

type Handlers []Handler

Handlers 端点注册接口组

Register

type Register interface {
	// Grpc gRPC服务
	Grpc(server *grpc.Server)

	// Gateway 网关服务
	Gateway(mux *runtime.ServeMux, opts *[]grpc.DialOption) (ctx context.Context, handlers Handlers)
}

Server

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

Server gRPC服务器封装

NewServer

func NewServer(
	rpc *grpc.Server,
	mux *http.ServeMux,
	server *config.Server, gateway *config.Gateway,
	logger log.Logger,
) *Server

Server.Serve

func (s *Server) Serve(register Register) (err error)

Server.Stop

func (s *Server) Stop(ctx context.Context) (err error)

Dependency graph