grpcrun

package
v0.0.0-...-33cc48e Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package grpcrun @Author: Ciusyan 2023/2/26

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoGrpc

type GoGrpc struct {
	Timeout time.Duration
	Task    map[string]*GrpcTask
	// contains filtered or unexported fields
}

GoGrpc is used to run some goroutine of grpc. the grpc's return will filled in response and error Example:

func example() {
	run := GoGrpc{}
	run.AddNewTask(nil, nil, nil)
	run.Call()
	run.Wait()
}

func NewGoGrpc

func NewGoGrpc() *GoGrpc

func (*GoGrpc) AddNewTask

func (g *GoGrpc) AddNewTask(grpcName string, grpcMethod any, request any)

func (*GoGrpc) AddTask

func (g *GoGrpc) AddTask(task *GrpcTask)

func (*GoGrpc) Run

func (g *GoGrpc) Run()

func (*GoGrpc) SetTimeout

func (g *GoGrpc) SetTimeout(timeout time.Duration)

SetTimeout reset timeout, replace default timeout with a special time duration

func (*GoGrpc) Wait

func (g *GoGrpc) Wait()

type GrpcTask

type GrpcTask struct {

	// GRPC的调用返回值
	Name     string
	Response any
	Err      error
	// contains filtered or unexported fields
}

GrpcTask 用于构建Grpc Task

func NewGrpcTask

func NewGrpcTask(ctx *context.Context, grpcName string, grpcMethod any, request any) *GrpcTask

NewGrpcTask creates a new GrpcTask

Note: @param grpcName string name of the grpc, this should be unique

func (*GrpcTask) Call

func (c *GrpcTask) Call()

Call 去调用GRPC的方法

Jump to

Keyboard shortcuts

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