Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type Grpc
- func (g *Grpc) AddRegistryTags(tags ...string)
- func (g *Grpc) Address() string
- func (g *Grpc) GetMetadata(key string) interface{}
- func (g *Grpc) HasInitializer() bool
- func (g *Grpc) Host() string
- func (g *Grpc) Initializer() component.Initializer
- func (g *Grpc) Port() int
- func (g *Grpc) RegistryTags() []string
- func (g *Grpc) String() string
- type Initializer
- type Option
Constants ¶
const (
// SERVER_TYPE is the type of the server.
SERVER_TYPE = "grpc"
)
Variables ¶
var ( // ErrRequiredGRPCRegistrar returned when gRPC registration callback is not provided ErrRequiredGRPCRegistrar = errors.New("gRPC registration callback is required") // ErrGRPCConfigLoad returned when env config for GRPC results in an error ErrGRPCConfigLoad = errors.New("error loading grpc config") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Host string `env:"GRPC_HOST,defaut="`
Port int `env:"GRPC_PORT,default=9090"`
Tags string `env:"GRPC_CONSUL_TAGS,default="`
}
Config manages the HTTP server config
func NewConfig ¶
func NewConfig() *Config
NewConfig returns the parsed config for jetstream from env
type Grpc ¶
type Grpc struct {
ServerOptions []grpc.ServerOption
DialOptions []grpc.DialOption
Server *grpc.Server
*Config
// contains filtered or unexported fields
}
Grpc holds gRPC config
func (*Grpc) AddRegistryTags ¶
AddRegistryTags - sets the registry tags for the server
func (*Grpc) GetMetadata ¶
GetMetadata returns the metadata by key
func (*Grpc) HasInitializer ¶
func (*Grpc) Initializer ¶
func (g *Grpc) Initializer() component.Initializer
func (*Grpc) RegistryTags ¶
RegistryTags returns gRPC server registry tags
type Initializer ¶
type Initializer struct {
// contains filtered or unexported fields
}
func NewInitializer ¶
func NewInitializer(g *Grpc) *Initializer
NewInitializer returns a new JetStream Initialiazer
func (*Initializer) AddDependency ¶
func (i *Initializer) AddDependency(dep interface{}) error
AddDependency adds necessary service components as dependencies
func (*Initializer) CanRun ¶
func (i *Initializer) CanRun() bool
CanRun returns true if the component has anything to Run
func (*Initializer) CanStop ¶
func (i *Initializer) CanStop() bool
CanRun returns true if the component has anything to Run
func (*Initializer) Dependencies ¶
func (i *Initializer) Dependencies() []string
Dependencies returns the string names of service components that are required as dependencies for this component
type Option ¶
type Option func(*Grpc)
Option to pass as arg while creating new service
func WithGRPCDialOptions ¶
func WithGRPCDialOptions(opts ...grpc.DialOption) Option
WithGRPCDialOptions overrides custom dial options
func WithGrpcServerOptions ¶
func WithGrpcServerOptions(opts ...grpc.ServerOption) Option
WithGrpcServerOptions adds gRPC options