Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler interface {
Name() string
Handler() interface{}
Options() HandlerOptions
}
Handler interface represents a request handler. It's generated by passing any type of public concrete object with endpoints into server.NewHandler. Most will pass in a struct.
Example:
type Greeter struct {}
func (g *Greeter) Hello(context, request, response) error {
return nil
}
type HandlerOption ¶
type HandlerOption func(*HandlerOptions)
type HandlerOptions ¶
type Options ¶
type Options struct {
Network string
Addr string
Timeout string
ReadTimeout string
WriteTimeout string
On bool // pref switch
Once sync.Once // do once
//
//
//
Metadata map[string]string
Name string
Id string
Version string
// Other options for implementations of the interface
// can be stored in a context
Context context.Context
}
type Server ¶
type Server interface {
// Initialise options
Init(...Option) error
// Retrieve the options
Options() Options
// Start the server
Start() error
// Stop the server
Stop(ctx context.Context) error
// Server implementation
String() string
}
Server is a simple micro server abstraction
type Subscriber ¶
type Subscriber interface {
Topic() string
Subscriber() interface{}
Options() SubscriberOptions
}
Subscriber interface represents a subscription to a given topic using a specific subscriber function or object with endpoints. It mirrors the handler in its behaviour.
type SubscriberOption ¶
type SubscriberOption func(*SubscriberOptions)
Click to show internal directories.
Click to hide internal directories.