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