modules

package
v0.0.0-...-ca61c3d Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("server",

	fx.Provide(
		New,
	),

	fx.Provide(
		fx.Private,
		parseConfig,
	),

	fx.Invoke(startServer),

	fx.Decorate(wrapLogger),
)

Module is an example of an Fx module's skeleton. --8<-- [start:start]

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr string `yaml:"addr"`
}

Config is the configuration of the server. --8<-- [start:config]

type Params

type Params struct {
	fx.In

	Log    *zap.Logger
	Config Config
}

Params defines the parameters of the module. --8<-- [start:params]

type Result

type Result struct {
	fx.Out

	Server *Server
}

Result defines the results of the module. --8<-- [start:result]

func New

func New(p Params) (Result, error)

New builds a new server. --8<-- [start:new]

type Server

type Server struct{}

Server is the server.

func (*Server) Start

func (*Server) Start() error

Start starts the server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳