gwquery

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT, BSD-3-Clause Imports: 18 Imported by: 0

README

gRPC Gateway query

The gwquery package contains a slightly modified copy of the query.go file from gRPC Gateway, copied from github.com/grpc-ecosystem/grpc-gateway/blob/main/runtime/query.go, and is licensed according to ./LICENSE. The parseField method is modified to avoid depending on the global protoregistry, which doesn't work in grpcbridge's case where each target has its own registry.

TODO(renbou): push a fix upstream once this is tested to properly work with grpcbridge

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(val string) ([]byte, error)

Bytes converts the given string representation of a byte sequence into a slice of bytes A bytes sequence is encoded in URL-safe base64 without padding

func PopulateFieldFromPath

func PopulateFieldFromPath(msg proto.Message, fieldPathString string, value string) error

PopulateFieldFromPath sets a value in a nested Protobuf structure.

func PopulateQueryParameters

func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error

PopulateQueryParameters parses query parameters into "msg" using current query parser

Types

type DefaultQueryParser

type DefaultQueryParser struct{}

DefaultQueryParser is a QueryParameterParser which implements the default query parameters parsing behavior.

See https://github.com/grpc-ecosystem/grpc-gateway/issues/2632 for more context.

func (*DefaultQueryParser) Parse

func (*DefaultQueryParser) Parse(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error

Parse populates "values" into "msg". A value is ignored if its key starts with one of the elements in "filter".

type QueryParameterParser

type QueryParameterParser interface {
	Parse(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error
}

QueryParameterParser defines interface for all query parameter parsers

Jump to

Keyboard shortcuts

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