api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 34 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMiddlewareType

type AuthMiddlewareType = string
const (
	UserAuth  AuthMiddlewareType = "USER"
	AdminAuth AuthMiddlewareType = "ADMIN"
)

type Option

type Option func(*Server)

Option customizes the Server that New creates.

func WithGlobalTelemetry

func WithGlobalTelemetry() Option

WithGlobalTelemetry makes the server install its OpenTelemetry tracer provider, error handler and propagator as the process-wide ones when it starts. Only the startup wiring (main) asks for it: the OpenTelemetry API has no other way to give a provider to the instrumented libraries.

func WithListener

func WithListener(l net.Listener) Option

WithListener makes the HTTP server serve on an already bound listener instead of binding the configured address. A caller that needs a free port keeps it bound until the server uses it, instead of closing it and hoping that nothing else takes the port before the server binds it. The server owns the listener: it closes it when it stops, or when it is stopped before it started.

func WithMonitoringListener

func WithMonitoringListener(l net.Listener) Option

WithMonitoringListener is WithListener for the monitoring server: it serves on the given bound listener instead of binding the configured monitoring port. The monitoring port must still be configured (it decides whether a monitoring server exists). The server owns the listener.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the struct that represents the API server.

func New

func New(config *config.Config,
	services service.Services,
	zapLog *zap.Logger,
	opts ...Option,
) Server

New is used to create a new instance of the API server.

func (*Server) StartWithContext

func (s *Server) StartWithContext(ctx context.Context)

func (*Server) Stop

func (s *Server) Stop(ctx context.Context)

Stop shutdown the API server. It waits for StartWithContext to return (servers drained) or for ctx to be done.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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