Documentation
¶
Index ¶
- func ErrorHandler(name string, a AppContext, handler AppHandler) micro.Handler
- func GetQueryHeaders(headers micro.Headers, key string) []string
- func HandleNotify(s micro.Service, healthFuncs ...func(chan<- string, micro.Service)) error
- func MsgID(r micro.Request) (string, error)
- func NewMsgWithID() *nats.Msg
- func RequestLogger(l *slog.Logger, r micro.Request) (*slog.Logger, error)
- func RequestToMsg(r micro.Request) *nats.Msg
- type AppContext
- type AppHandler
- type ClientError
- type ClientOpt
- type HandlerContext
- type HandlerWithErrors
- type NATSClient
- type NATSGraph
- type NatsLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶
func ErrorHandler(name string, a AppContext, handler AppHandler) micro.Handler
ErrorHandler wraps a normal micro endpoint and allows for returning errors natively. Errors are checked and if an error is a client error, details are returned, otherwise a 500 is returned and logged
func HandleNotify ¶
func NewMsgWithID ¶
func NewMsgWithID() *nats.Msg
func RequestToMsg ¶
Types ¶
type AppContext ¶
type AppContext struct { Conn *nats.Conn Logger *slog.Logger Tracer trace.Tracer Propagator propagation.TextMapPropagator }
func (AppContext) InjectTraceHeaders ¶ added in v1.1.0
func (a AppContext) InjectTraceHeaders(ctx context.Context, headers map[string][]string)
type AppHandler ¶
type ClientError ¶
type ClientOpt ¶
type ClientOpt func(*NATSClient)
func SetGraphQLExecutableSchema ¶
func SetGraphQLExecutableSchema(e graphql.ExecutableSchema) ClientOpt
func SetOptions ¶
func SetOptions(opts ...nats.Option) ClientOpt
func SetServers ¶
func SetSubject ¶
type HandlerContext ¶
type HandlerContext struct { Logger *slog.Logger Conn *nats.Conn Tracer trace.Tracer Propagator propagation.TextMapPropagator }
type NATSClient ¶
type NATSClient struct { Subject string Servers string Options []nats.Option Conn *nats.Conn JS nats.JetStreamContext NATSGraph }
func NewNATSClient ¶
func NewNATSClient(subject string, servers []string, opts ...ClientOpt) *NATSClient
func (*NATSClient) Connect ¶
func (n *NATSClient) Connect() error
func (*NATSClient) HandleAndLogRequests ¶
func (n *NATSClient) HandleAndLogRequests(m *nats.Msg)
func (*NATSClient) Resolve ¶
func (n *NATSClient) Resolve(errChan chan<- error)
type NATSGraph ¶
type NATSGraph struct { ExecutableSchema graphql.ExecutableSchema Exec *executor.Executor }
type NatsLogger ¶
type NatsLogger struct {
// contains filtered or unexported fields
}
func NewNatsLogger ¶
func NewNatsLogger(subject string, nc *nats.Conn) NatsLogger
Click to show internal directories.
Click to hide internal directories.