micro/service/service.go

26 lines
643 B
Go
Raw Normal View History

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