directory

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

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

View Source
const Hostname = "directory.example"

Hostname is the default hostname of the microservice: directory.example.

View Source
const SourceCodeSHA256 = "eb91ecac3ffe95e4b7fc8899bbf2d8ebef41506c9143eaa3340a0e946eec9f0e"
View Source
const Timestamp = "2024-07-06T16:56:54.676801Z"
View Source
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.

func NewMock

func NewMock() *Mock

New creates a new mockable version of the microservice.

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) Delete

func (svc *Service) Delete(ctx context.Context, key directoryapi.PersonKey) (err error)

Delete removes a person from the directory.

func (*Service) Init

func (svc *Service) Init(initializer func(svc *Service)) *Service

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

func (svc *Service) OnShutdown(ctx context.Context) (err error)

OnShutdown is called when the microservice is shut down.

func (*Service) OnStartup

func (svc *Service) OnStartup(ctx context.Context) (err error)

OnStartup is called when the microservice is started up.

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.

func (*Service) WebUI

func (svc *Service) WebUI(w http.ResponseWriter, r *http.Request) (err error)

WebUI provides a form for making web requests to the CRUD endpoints.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL