service

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode uint8

Mode represents which services the application should run. Uses bitmask for easy combination.

const (
	ModeWeb Mode = 1 << iota // Web SSR (templates, static files)
	ModeAPI                  // JSON API endpoints
	ModeWS                   // WebSocket service

	ModeAll = ModeWeb | ModeAPI | ModeWS // Monolith — all HTTP services
)

func ParseMode

func ParseMode(s string) (Mode, error)

ParseMode parses a comma-separated mode string into a Mode bitmask. Valid inputs: "all", "web", "api", "ws", "api,ws", "web,api", etc. Returns error for empty or invalid mode strings.

func (Mode) Has

func (m Mode) Has(flag Mode) bool

Has returns true if the mode includes the given flag.

func (Mode) PortEnvKey

func (m Mode) PortEnvKey() string

PortEnvKey returns the environment variable name for the port of a single-mode constant.

func (Mode) Services

func (m Mode) Services() []Mode

Services returns the list of individual modes active in this bitmask.

func (Mode) String

func (m Mode) String() string

String returns a human-readable representation of the mode.

Jump to

Keyboard shortcuts

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