Categorygithub.com/dudebing99/grpc-connection-pool
modulepackage
1.0.2
Repository: https://github.com/dudebing99/grpc-connection-pool.git
Documentation: pkg.go.dev

# README

Usage

go get github.com/dudebing99/grpc-connection-pool

Example

package main

import (
	"context"
	"fmt"
	rpc "github.com/dudebing99/grpc-connection-pool"
)

func main() {
	pool, err := rpc.NewRpcClientPool(rpc.WithServerAddr("0.0.0.0:8080"))
	if err != nil {
		fmt.Println("init client pool error")
		return
	}

	clientConn, close, err := pool.Acquire()
	defer close()
	if err != nil {
		fmt.Println("acquire client connection error")
		return
	}

	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()
	reply, err := NewGreeterClient(clientConn).SayHello(ctx, &HelloRequest{Name: "SillyBoy"})
	if err != nil {
		fmt.Println("say hello error, ", err)
		return
	}

	fmt.Println(reply.Message)
}

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

Destroy Failure occurs and cannot be restored.
Put Not available.
Ready Can be used.

# Structs

No description provided by the author

# Type aliases

CloseFunc should defer.
No description provided by the author