Documentation
¶
Index ¶
- Constants
- Variables
- func NewTags(opts *Options) []string
- type Option
- func AfterStart(fn func()) Option
- func AfterStop(fn func()) Option
- func BeforeStart(fn func()) Option
- func BeforeStop(fn func()) Option
- func SetHost(host string) Option
- func SetName(n string) Option
- func SetPort(port string) Option
- func SetRegistry(r *api.Client) Option
- func SetRegistryTTL(t time.Duration) Option
- func SetServer(s http.Handler) Option
- func SetVersion(v string) Option
- type Options
- type Resolver
- type Service
Constants ¶
View Source
const ( GRPC = iota GIN )
server type list
Variables ¶
View Source
var ( // DefaultRegistry - DefaultRegistry = newRegistry() // DefaultRegistryTTL - default DefaultRegistryTTL = 30 * time.Second )
View Source
var ( // DefaultServer - DefaultServer = newRPCServer() // DefaultHost - DefaultHost = newHost() // DefaultPort - DefaultPort = "0" // DefaultHook - DefaultHook = func() {} )
View Source
var ServerType int
ServerType -
Functions ¶
Types ¶
type Options ¶
type Options struct { Server http.Handler Host string Port string Listener net.Listener // Registry Client Registry *api.Client // Registry TTL RegistryTTL time.Duration // Before and After funcs BeforeStart func() BeforeStop func() AfterStart func() AfterStop func() // contains filtered or unexported fields }
Options -
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver implements the gRPC Resolver interface using a Consul backend.
func NewResolver ¶
NewResolver initializes and returns a new Resolver.
type Service ¶
type Service interface { // The service id ID() string // The service name Name() string // Initialize Init(...Option) // Version Version() string // Run the service Run() error // Options returns the current options Options() Options // The server Server() http.Handler // The server type ServerType() string }
Service -
func NewService ¶
NewService - creates and returns a new Service
Click to show internal directories.
Click to hide internal directories.