grpcinvoke

package module
v0.0.0-...-43e2ce0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

grpcinvoke

protobuf 我们一般需要先使用 proto工具将proto文件转换成代码文件,然后进行编译,才能使用。

这个项目提供了一个思路和示例用于动态的根据proto文件生成grpc二进制数据,不需要提前使用proto 工具进行编译。

只是提供思路,和示例代码,有问题欢迎提pr、issue。

用法示例

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyInnerMessage = InnerMessage{}
)
View Source
var (
	ErrProto3Invalid = errors.New("proto3 invalid")
)

Functions

This section is empty.

Types

type GrpcInvokeEngine

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

func NewGrpcInvoke

func NewGrpcInvoke(loadder ProtoSourceIf, target string, opts ...grpc.DialOption) *GrpcInvokeEngine

func (*GrpcInvokeEngine) Call

func (me *GrpcInvokeEngine) Call(filename, servicename, methodname string,
	req map[string]interface{}, rep *map[string]interface{}, ctx context.Context, opts ...grpc.CallOption) error

func (*GrpcInvokeEngine) SetKeyVal

func (me *GrpcInvokeEngine) SetKeyVal(filename, methodname, key string, value interface{})

type GrpcInvokeIf

type GrpcInvokeIf interface {
	// contains filtered or unexported methods
}

type InnerMessage

type InnerMessage struct {
}

func (*InnerMessage) IsEmpty

func (me *InnerMessage) IsEmpty() bool

func (*InnerMessage) String

func (me *InnerMessage) String() string

type ProtoCache

type ProtoCache struct{}

func (ProtoCache) Load

func (p ProtoCache) Load()

type ProtoFile

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

func (*ProtoFile) AddProto

func (p *ProtoFile) AddProto(name, path string)

func (*ProtoFile) ImportProtoWithList

func (p *ProtoFile) ImportProtoWithList(filepaths map[string]string)

func (*ProtoFile) IncludeProto

func (p *ProtoFile) IncludeProto(path string)

type ProtoSourceIf

type ProtoSourceIf interface {
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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