apis

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRegistrar

func DefaultRegistrar(_ Context, router *gin.Engine) error

DefaultRegistrar returns the default API registrar

Types

type Config

type Config struct {
	Address string `yaml:"address,omitempty"`
	Port    uint   `yaml:"port"`
}

func ParseConfig

func ParseConfig(bz []byte) (*Config, error)

type Configurator

type Configurator func(router *gin.Engine, server *http.Server)

Configurator represents a function allowing to configure the Gin engine and the HTTP server. NOTE: Use this method only to configure either the router or the server, and NOT to register routes. Those will be registered using the various registrars set inside the module.

type Context

type Context struct {
	registrar.Context
	GRPCConnection *grpc.ClientConn
}

Context contains all the useful data that might be used when registering an API handler

func NewContext

func NewContext(ctx registrar.Context, grpcConnection *grpc.ClientConn) Context

type Module

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

Module represents the module allowing to register custom API endpoints

func NewModule

func NewModule(ctx Context) *Module

func (*Module) Logger

func (m *Module) Logger() gin.HandlerFunc

Logger returns a Gin Handler function that logs endpoint calls using ZeroLog

func (*Module) Name

func (m *Module) Name() string

func (*Module) RunAdditionalOperations

func (m *Module) RunAdditionalOperations() error

RunAdditionalOperations implements modules.AdditionalOperationsModule

func (*Module) WithConfigurator

func (m *Module) WithConfigurator(configurator Configurator) *Module

WithConfigurator allows setting the configurator to be used

func (*Module) WithRegistrar

func (m *Module) WithRegistrar(registrar Registrar) *Module

WithRegistrar allows setting the APIs registrar to be used

type Registrar

type Registrar func(ctx Context, router *gin.Engine) error

Registrar represents a function that allows registering API endpoints

func CombinedRegistrar

func CombinedRegistrar(registrars ...Registrar) Registrar

CombinedRegistrar returns a new Registrar combining the given API registrars together

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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