1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00
go-micro/service/service.go

26 lines
637 B
Go
Raw Normal View History

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 (
"github.com/micro/go-micro/client"
"github.com/micro/go-micro/server"
)
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
}