exposefx

package
v0.0.0-...-c5572cb Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

exposefx contains helper methods to expose functions to a fx app and to provide the handler

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Provide

func Provide[TService any](fns ...func(s TService) expose.Function) fx.Option

Provide registers the exposed functions of serivces in fx

func ProvideFunc

func ProvideFunc(fns ...expose.Function) fx.Option

ProvideFunc registers the exposed functions in fx

func ProvideHandler

func ProvideHandler(opts ...expose.HandlerOption) fx.Option

ProvideHandler provides the expose handler

func ProvideRouter

func ProvideRouter(ctor any) fx.Option

ProvideRouter provides the `ctor` as Router

Types

type ExposeResult

type ExposeResult struct {
	fx.Out
	Function expose.Function `group:"expose_functions"`
}

type HandlerParams

type HandlerParams struct {
	fx.In
	ExposedFunctions []expose.Function `group:"expose_functions"`
	ExposedRouters   []Router          `group:"expose_routers"`
}

func (HandlerParams) Functions

func (p HandlerParams) Functions() []expose.Function

type Router

type Router interface {
	Expose() []expose.Function
}

Router can be implemented to colocate routes with their handlers

Jump to

Keyboard shortcuts

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