Documentation
¶
Index ¶
- func MetadataFromHeaders(headers []string) metadata.MD
- func ParseArgumentParam(argument string) (name string, value string, err error)
- type ConnectionConnectionSupplier
- type ConnectionSupplier
- type DMHOption
- type DefaultConnectionSupplier
- type DefaultDescribeOutput
- func (d *DefaultDescribeOutput) DumpEnum(level int, enum *desc.EnumDescriptor) error
- func (d *DefaultDescribeOutput) DumpField(level int, fld *desc.FieldDescriptor) error
- func (d *DefaultDescribeOutput) DumpMessage(level int, msg *desc.MessageDescriptor) error
- func (d *DefaultDescribeOutput) DumpMethod(level int, mtd *desc.MethodDescriptor, complete bool) error
- func (d *DefaultDescribeOutput) DumpService(level int, svc *desc.ServiceDescriptor) error
- func (d *DefaultDescribeOutput) OutputDescribe(descriptor desc.Descriptor) error
- type DefaultInvokeOutput
- type DefaultServiceListOutput
- type DefaultServiceOutput
- type DescribeOutput
- type DynMsgHelper
- func (h *DynMsgHelper) GetFieldValue(msg *dynamic.Message, fld *desc.FieldDescriptor) (ok bool, value string, err error)
- func (h *DynMsgHelper) MustParseScalarFieldValue(fld *desc.FieldDescriptor, value string) (retval interface{}, err error)
- func (h *DynMsgHelper) ParseFieldParamValue(fld *desc.FieldDescriptor, value string) (interface{}, error)
- func (h *DynMsgHelper) ParseScalarFieldValue(fld *desc.FieldDescriptor, value string) (supported bool, retval interface{}, err error)
- func (h *DynMsgHelper) SetParamValue(msg *dynamic.Message, name, value string) error
- type DynMsgHelperFieldValueGetter
- type DynMsgHelperFieldValueParser
- type GetOption
- func WithConnection(conn *grpc.ClientConn) GetOption
- func WithConnectionSupplier(supplier ConnectionSupplier) GetOption
- func WithDMHOpts(opts ...DMHOption) GetOption
- func WithDefaultConnection(ctx context.Context, target string, opts ...grpc.DialOption) GetOption
- func WithDefaultOutputs(w io.Writer) GetOption
- func WithOutputDescribe(output DescribeOutput) GetOption
- func WithOutputInvoke(output InvokeOutput) GetOption
- func WithOutputService(output ServiceOutput) GetOption
- func WithOutputServiceList(output ServiceListOutput) GetOption
- type GrpcGet
- func (g *GrpcGet) Describe(ctx context.Context, symbol string) error
- func (g *GrpcGet) Invoke(ctx context.Context, method string, opts ...InvokeOption) error
- func (g *GrpcGet) ListService(ctx context.Context, service string) error
- func (g *GrpcGet) ListServices(ctx context.Context) error
- func (g *GrpcGet) SetOpts(opts ...GetOption) *GrpcGet
- type InvokeOption
- type InvokeOutput
- type InvokeParamSetter
- type ParameterInvokeParamSetter
- type ServiceListOutput
- type ServiceOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MetadataFromHeaders ¶
MetadataFromHeaders converts a list of header strings (each string in "Header-Name=Header-Value" form) into metadata. If a string has a header name without a value (e.g. does not contain a colon), the value is assumed to be blank. Binary headers (those whose names end in "-bin") should be base64-encoded. But if they cannot be base64-decoded, they will be assumed to be in raw form and used as is.
Types ¶
type ConnectionConnectionSupplier ¶
type ConnectionConnectionSupplier struct {
Conn *grpc.ClientConn
}
ConnectionSupplier - Connection
func NewConnectionConnectionSupplier ¶
func NewConnectionConnectionSupplier(conn *grpc.ClientConn) *ConnectionConnectionSupplier
func (*ConnectionConnectionSupplier) GetConnection ¶
func (d *ConnectionConnectionSupplier) GetConnection(ctx context.Context) (*grpc.ClientConn, error)
type ConnectionSupplier ¶
type ConnectionSupplier interface {
GetConnection(ctx context.Context) (*grpc.ClientConn, error)
}
Interface to supply a connection to GrpcGet
type DMHOption ¶
type DMHOption func(*dmhOptions)
func WithDMHFieldValueGetters ¶
func WithDMHFieldValueGetters(getters ...DynMsgHelperFieldValueGetter) DMHOption
func WithDMHFieldValueParsers ¶
func WithDMHFieldValueParsers(setters ...DynMsgHelperFieldValueParser) DMHOption
type DefaultConnectionSupplier ¶
type DefaultConnectionSupplier struct { Ctx context.Context Target string Opts []grpc.DialOption }
ConnectionSupplier - Default
func NewDefaultConnectionSupplier ¶
func NewDefaultConnectionSupplier(ctx context.Context, target string, opts ...grpc.DialOption) *DefaultConnectionSupplier
func (*DefaultConnectionSupplier) GetConnection ¶
func (d *DefaultConnectionSupplier) GetConnection(ctx context.Context) (*grpc.ClientConn, error)
type DefaultDescribeOutput ¶
DescribeOutput
func NewDefaultDescribeOutput ¶
func NewDefaultDescribeOutput(out io.Writer) *DefaultDescribeOutput
func (*DefaultDescribeOutput) DumpEnum ¶
func (d *DefaultDescribeOutput) DumpEnum(level int, enum *desc.EnumDescriptor) error
func (*DefaultDescribeOutput) DumpField ¶
func (d *DefaultDescribeOutput) DumpField(level int, fld *desc.FieldDescriptor) error
func (*DefaultDescribeOutput) DumpMessage ¶
func (d *DefaultDescribeOutput) DumpMessage(level int, msg *desc.MessageDescriptor) error
func (*DefaultDescribeOutput) DumpMethod ¶
func (d *DefaultDescribeOutput) DumpMethod(level int, mtd *desc.MethodDescriptor, complete bool) error
func (*DefaultDescribeOutput) DumpService ¶
func (d *DefaultDescribeOutput) DumpService(level int, svc *desc.ServiceDescriptor) error
func (*DefaultDescribeOutput) OutputDescribe ¶
func (d *DefaultDescribeOutput) OutputDescribe(descriptor desc.Descriptor) error
type DefaultInvokeOutput ¶
InvokeOutput
func NewDefaultInvokeOutput ¶
func NewDefaultInvokeOutput(out io.Writer) *DefaultInvokeOutput
func (*DefaultInvokeOutput) DumpMessage ¶
func (d *DefaultInvokeOutput) DumpMessage(dmh *DynMsgHelper, level int, msg *dynamic.Message) error
func (*DefaultInvokeOutput) OutputInvoke ¶
func (d *DefaultInvokeOutput) OutputInvoke(dmh *DynMsgHelper, value proto.Message) error
type DefaultServiceListOutput ¶
ServiceListOutput
func NewDefaultServiceListOutput ¶
func NewDefaultServiceListOutput(out io.Writer) *DefaultServiceListOutput
func (*DefaultServiceListOutput) OutputServiceList ¶
func (d *DefaultServiceListOutput) OutputServiceList(services []string) error
type DefaultServiceOutput ¶
ServiceOutput
func NewDefaultServiceOutput ¶
func NewDefaultServiceOutput(out io.Writer) *DefaultServiceOutput
func (*DefaultServiceOutput) OutputService ¶
func (d *DefaultServiceOutput) OutputService(service *desc.ServiceDescriptor) error
type DescribeOutput ¶
type DescribeOutput interface {
OutputDescribe(descriptor desc.Descriptor) error
}
Interface that outputs descrption of a symbol
type DynMsgHelper ¶
type DynMsgHelper struct {
// contains filtered or unexported fields
}
DynMsgHelper is a helper for setting and getting values from a *dynamic.Message struct It supports getter and setter customizations to support custom data types.
func NewDynMsgHelper ¶
func NewDynMsgHelper(opts ...DMHOption) *DynMsgHelper
Creates a new DynMsgHelper
func (*DynMsgHelper) GetFieldValue ¶
func (h *DynMsgHelper) GetFieldValue(msg *dynamic.Message, fld *desc.FieldDescriptor) (ok bool, value string, err error)
Gets the value of a field using a DynMsgHelperFieldValueGetter
func (*DynMsgHelper) MustParseScalarFieldValue ¶
func (h *DynMsgHelper) MustParseScalarFieldValue(fld *desc.FieldDescriptor, value string) (retval interface{}, err error)
func (*DynMsgHelper) ParseFieldParamValue ¶
func (h *DynMsgHelper) ParseFieldParamValue(fld *desc.FieldDescriptor, value string) (interface{}, error)
Sets the value of a field on the message. It supports DynMsgHelperFieldSetter for types that are not scalar.
func (*DynMsgHelper) ParseScalarFieldValue ¶
func (h *DynMsgHelper) ParseScalarFieldValue(fld *desc.FieldDescriptor, value string) (supported bool, retval interface{}, err error)
func (*DynMsgHelper) SetParamValue ¶
func (h *DynMsgHelper) SetParamValue(msg *dynamic.Message, name, value string) error
Sets a parameter value into the message. The name can have "." to set values inside another messages, like address.street_name.
type DynMsgHelperFieldValueGetter ¶
type DynMsgHelperFieldValueGetter interface {
GetFieldValue(msg *dynamic.Message, fld *desc.FieldDescriptor) (ok bool, value string, err error)
}
Getter
type DynMsgHelperFieldValueParser ¶
type DynMsgHelperFieldValueParser interface {
ParseFieldValue(fld *desc.FieldDescriptor, value string) (ok bool, retval interface{}, err error)
}
Setter
type GetOption ¶
type GetOption func(*getOptions)
Get options for GrpcGet
func WithConnection ¶
func WithConnection(conn *grpc.ClientConn) GetOption
func WithConnectionSupplier ¶
func WithConnectionSupplier(supplier ConnectionSupplier) GetOption
func WithDMHOpts ¶
func WithDefaultConnection ¶
func WithDefaultOutputs ¶
func WithOutputDescribe ¶
func WithOutputDescribe(output DescribeOutput) GetOption
func WithOutputInvoke ¶
func WithOutputInvoke(output InvokeOutput) GetOption
func WithOutputService ¶
func WithOutputService(output ServiceOutput) GetOption
func WithOutputServiceList ¶
func WithOutputServiceList(output ServiceListOutput) GetOption
type GrpcGet ¶
type GrpcGet struct {
// contains filtered or unexported fields
}
GrpcGet is the client that talks to the gRPC server
func NewGrpcGet_Default ¶
Creates a new GrpcGet without default outputs
func (*GrpcGet) ListService ¶
List a single service and call ServiceOutput.OutputService
func (*GrpcGet) ListServices ¶
List services and call ServiceListOutput.OutputServiceList
type InvokeOption ¶
type InvokeOption func(*invokeOptions)
Invoke option
func WithInvokeParams ¶
func WithInvokeParams(params ...string) InvokeOption
type InvokeOutput ¶
type InvokeOutput interface {
OutputInvoke(dmh *DynMsgHelper, value proto.Message) error
}
Interface that outputs the response of an invoke
type InvokeParamSetter ¶
type InvokeParamSetter interface {
SetInvokeParam(dmh *DynMsgHelper, req *dynamic.Message) error
}
Setter for an invoke parameters
type ParameterInvokeParamSetter ¶
type ParameterInvokeParamSetter struct {
Params []string
}
ParameterInvokeParamSetter
Params are in the format name=value
func NewParameterInvokeParamSetter ¶
func NewParameterInvokeParamSetter(params ...string) *ParameterInvokeParamSetter
func (*ParameterInvokeParamSetter) SetInvokeParam ¶
func (i *ParameterInvokeParamSetter) SetInvokeParam(dmh *DynMsgHelper, req *dynamic.Message) error
type ServiceListOutput ¶
Interface that outputs a service list
type ServiceOutput ¶
type ServiceOutput interface {
OutputService(service *desc.ServiceDescriptor) error
}
Interface that outputs a single service and its methods