Some network inspiration
This commit is contained in:
35
network/options.go
Normal file
35
network/options.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"github.com/micro/go-micro/client"
|
||||
"github.com/micro/go-micro/server"
|
||||
)
|
||||
|
||||
type Option func(*Options)
|
||||
|
||||
type Options struct {
|
||||
Name string
|
||||
Client client.Client
|
||||
Server server.Server
|
||||
}
|
||||
|
||||
// The network name
|
||||
func Name(n string) Option {
|
||||
return func(o *Options) {
|
||||
o.Name = n
|
||||
}
|
||||
}
|
||||
|
||||
// The network client
|
||||
func Client(c client.Client) Option {
|
||||
return func(o *Options) {
|
||||
o.Client = c
|
||||
}
|
||||
}
|
||||
|
||||
// The network server
|
||||
func Server(s server.Server) Option {
|
||||
return func(o *Options) {
|
||||
o.Server = s
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user