2019-06-06 10:02:00 +02:00
|
|
|
// Package service encapsulates the client, server and other interfaces to provide a complete micro service.
|
|
|
|
package service
|
2019-08-06 18:53:14 +02:00
|
|
|
|
|
|
|
import (
|
2020-01-30 13:39:00 +02:00
|
|
|
"github.com/micro/go-micro/v2/client"
|
|
|
|
"github.com/micro/go-micro/v2/server"
|
2019-08-06 18:53:14 +02:00
|
|
|
)
|
|
|
|
|
2019-10-07 09:34:15 +02:00
|
|
|
// Service is an interface for a micro service
|
2019-08-06 18:53:14 +02:00
|
|
|
type Service interface {
|
2019-10-07 09:34:15 +02:00
|
|
|
// The service name
|
|
|
|
Name() string
|
|
|
|
// Init initialises options
|
2019-08-06 18:53:14 +02:00
|
|
|
Init(...Option)
|
2019-10-07 09:34:15 +02:00
|
|
|
// Options returns the current options
|
2019-08-06 18:53:14 +02:00
|
|
|
Options() Options
|
2019-10-07 09:34:15 +02:00
|
|
|
// Client is used to call services
|
2019-08-06 18:53:14 +02:00
|
|
|
Client() client.Client
|
2019-10-07 09:34:15 +02:00
|
|
|
// Server is for handling requests and events
|
2019-08-06 18:53:14 +02:00
|
|
|
Server() server.Server
|
2019-10-07 09:34:15 +02:00
|
|
|
// Run the service
|
2019-08-06 18:53:14 +02:00
|
|
|
Run() error
|
2019-10-07 09:34:15 +02:00
|
|
|
// The service implementation
|
2019-08-06 18:53:14 +02:00
|
|
|
String() string
|
|
|
|
}
|