service

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeLayers

func ComposeLayers[Req, Resp any, S Service[Req, Resp], L Layer[Req, Resp, S]](service S, layers ...L) S

Types

type Layer

type Layer[Req, Resp any, S Service[Req, Resp]] interface {
	Next(service S) S
}

type LayerFn

type LayerFn[Req, Resp any, S Service[Req, Resp]] func(service S) S

func (LayerFn[Req, Resp, S]) Next

func (self LayerFn[Req, Resp, S]) Next(service S) S

type Service

type Service[Req, Resp any] interface {
	// Call is the entry point for the service.
	Call(ctx context.Context, req Req) result.Result[Resp]
}

Service is the interface that provides the business logic for the service.

type ServiceFn

type ServiceFn[Req, Resp any] func(context.Context, Req) result.Result[Resp]

ServiceFn is the function type that implements the Service interface.

func (ServiceFn[Req, Resp]) Call

func (self ServiceFn[Req, Resp]) Call(ctx context.Context, req Req) result.Result[Resp]

Jump to

Keyboard shortcuts

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