Documentation
¶
Index ¶
- type HeaderMatcherFunc
- type JSONConfig
- type Option
- func WithCORS(options *cors.Options) Option
- func WithIncomingHeaderMatcher(matcher HeaderMatcherFunc) Option
- func WithJSONConfig(config *JSONConfig) Option
- func WithMuxOptions(options ...runtime.ServeMuxOption) Option
- func WithOutgoingHeaderMatcher(matcher HeaderMatcherFunc) Option
- func WithPprof(enabled bool) Option
- func WithServices(registrars ...service.Registrar) Option
- func WithSwagger(dir, basePath string) Option
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeaderMatcherFunc ¶
HeaderMatcherFunc is a function for matching headers in gRPC gateway
type JSONConfig ¶
type JSONConfig struct {
// UseProtoNames determines if proto or json names should be used
UseProtoNames bool `envconfig:"USE_PROTO_NAMES" default:"true"`
// EmitUnpopulated determines if unpopulated fields should be included
EmitUnpopulated bool `envconfig:"EMIT_UNPOPULATED" default:"true"`
// UseEnumNumbers renders enum values as numbers instead of strings
UseEnumNumbers bool `envconfig:"USE_ENUM_NUMBERS" default:"true"`
// AllowPartial allows incomplete proto messages
AllowPartial bool `envconfig:"ALLOW_PARTIAL" default:"true"`
// Multiline formats the output in indented form
Multiline bool `envconfig:"MULTILINE" default:"true"`
// Indent specifies the set of indentation characters to use in multiline mode
Indent string `envconfig:"INDENT" default:" "`
}
JSONConfig holds JSON marshaling configuration for the gateway
func DefaultJSONConfig ¶
func DefaultJSONConfig() *JSONConfig
DefaultJSONConfig returns a JSONConfig with default values
type Option ¶
type Option func(*Server)
Option is a function that configures a Server
func WithIncomingHeaderMatcher ¶
func WithIncomingHeaderMatcher(matcher HeaderMatcherFunc) Option
WithIncomingHeaderMatcher sets the incoming header matcher function
func WithJSONConfig ¶
func WithJSONConfig(config *JSONConfig) Option
WithJSONConfig sets the JSON configuration for the gateway
func WithMuxOptions ¶
func WithMuxOptions(options ...runtime.ServeMuxOption) Option
WithMuxOptions sets the gRPC-Gateway mux options
func WithOutgoingHeaderMatcher ¶
func WithOutgoingHeaderMatcher(matcher HeaderMatcherFunc) Option
WithOutgoingHeaderMatcher sets the outgoing header matcher function
func WithServices ¶
WithServices sets the service registrars for the gateway
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents a gRPC-Gateway server
func NewServer ¶
func NewServer( logger *slog.Logger, closeTimeout time.Duration, grpcAddress string, httpAddress string, opts ...Option, ) *Server
NewServer creates a new gRPC-Gateway server
Click to show internal directories.
Click to hide internal directories.