mirror of
				https://github.com/go-micro/go-micro.git
				synced 2025-10-30 23:27:41 +02:00 
			
		
		
		
	Add service Name
This commit is contained in:
		
							
								
								
									
										8
									
								
								micro.go
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								micro.go
									
									
									
									
									
								
							| @@ -14,11 +14,19 @@ type serviceKey struct{} | ||||
| // within go-micro. Its a convenience method for building | ||||
| // and initialising services. | ||||
| type Service interface { | ||||
| 	// The service name | ||||
| 	Name() string | ||||
| 	// Init initialises options | ||||
| 	Init(...Option) | ||||
| 	// Options returns the current options | ||||
| 	Options() Options | ||||
| 	// Client is used to call services | ||||
| 	Client() client.Client | ||||
| 	// Server is for handling requests and events | ||||
| 	Server() server.Server | ||||
| 	// Run the service | ||||
| 	Run() error | ||||
| 	// The service implementation | ||||
| 	String() string | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -37,6 +37,10 @@ func newService(opts ...Option) Service { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (s *service) Name() string { | ||||
| 	return s.opts.Server.Options().Name | ||||
| } | ||||
|  | ||||
| // Init initialises options. Additionally it calls cmd.Init | ||||
| // which parses command line flags. cmd.Init is only called | ||||
| // on first Init. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user