Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package directory implements the directory.example microservice.
The directory microservice exposes a RESTful API for persisting personal records in a SQL database.
Index ¶
- Constants
 - type Mock
 - type Service
 - func (svc *Service) Create(ctx context.Context, httpRequestBody *directoryapi.Person) (key directoryapi.PersonKey, err error)
 - func (svc *Service) Delete(ctx context.Context, key directoryapi.PersonKey) (err error)
 - func (svc *Service) Init(initializer func(svc *Service)) *Service
 - func (svc *Service) List(ctx context.Context) (httpResponseBody []directoryapi.PersonKey, err error)
 - func (svc *Service) Load(ctx context.Context, key directoryapi.PersonKey) (httpResponseBody *directoryapi.Person, err error)
 - func (svc *Service) LoadByEmail(ctx context.Context, email string) (httpResponseBody *directoryapi.Person, err error)
 - func (svc *Service) OnShutdown(ctx context.Context) (err error)
 - func (svc *Service) OnStartup(ctx context.Context) (err error)
 - func (svc *Service) Update(ctx context.Context, key directoryapi.PersonKey, ...) (err error)
 - func (svc *Service) WebUI(w http.ResponseWriter, r *http.Request) (err error)
 
Constants ¶
const Hostname = "directory.example"
    Hostname is the default hostname of the microservice: directory.example.
const SourceCodeSHA256 = "eb91ecac3ffe95e4b7fc8899bbf2d8ebef41506c9143eaa3340a0e946eec9f0e"
    const Timestamp = "2024-07-06T16:56:54.676801Z"
    const Version = 210
    Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mock ¶
type Mock = intermediate.Mock
Mock is a mockable version of the directory.example microservice, allowing functions, event sinks and web handlers to be mocked.
type Service ¶
type Service struct {
	*intermediate.Intermediate // DO NOT REMOVE
	// contains filtered or unexported fields
}
    Service implements the directory.example microservice.
The directory microservice exposes a RESTful API for persisting personal records in a SQL database.
func NewService ¶
func NewService() *Service
NewService creates a new directory.example microservice.
func (*Service) Create ¶
func (svc *Service) Create(ctx context.Context, httpRequestBody *directoryapi.Person) (key directoryapi.PersonKey, err error)
Create registers the person in the directory.
func (*Service) Init ¶
Init enables a single-statement pattern for initializing the microservice.
svc.Init(func(svc Service) {
	svc.SetGreeting("Hello")
})
  
  func (*Service) List ¶
func (svc *Service) List(ctx context.Context) (httpResponseBody []directoryapi.PersonKey, err error)
List returns the keys of all the persons in the directory.
func (*Service) Load ¶
func (svc *Service) Load(ctx context.Context, key directoryapi.PersonKey) (httpResponseBody *directoryapi.Person, err error)
Load looks up a person in the directory.
func (*Service) LoadByEmail ¶
func (svc *Service) LoadByEmail(ctx context.Context, email string) (httpResponseBody *directoryapi.Person, err error)
LoadByEmail looks up a person in the directory by their email.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
func (*Service) Update ¶
func (svc *Service) Update(ctx context.Context, key directoryapi.PersonKey, httpRequestBody *directoryapi.Person) (err error)
Update updates the person's data in the directory.
      
      Directories
      ¶
    
    | Path | Synopsis | 
|---|---|
| 
       app
        | 
      |
| 
         
          
            directory
            
            command
          
          
         
       | 
      |
| 
       Package directoryapi implements the public API of the directory.example microservice, including clients and data structures. 
         | 
      Package directoryapi implements the public API of the directory.example microservice, including clients and data structures. | 
| 
       Package intermediate serves as the foundation of the directory.example microservice. 
         | 
      Package intermediate serves as the foundation of the directory.example microservice. |