basic

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context) error

Types

type Config

type Config struct {
	Host    string `cfg:"host"     default:"localhost"`
	Port    int    `cfg:"port"     default:"8080"`
	PortPtr *int   `cfg:"port_ptr" default:"8080"`
	Test    int    `cfg:"test"     default:"1"`

	Duration    time.Duration  `cfg:"duration"     default:"1s"`
	DurationPtr *time.Duration `cfg:"duration_ptr" default:"2s"`

	// Database configuration
	DB struct {
		Pass string `cfg:"pass" log:"-"` // DB_PASS environment variable
	}

	Fn      func()     `log:"false"` // cannot be loaded, result is <nil>
	Channel <-chan int // cannot be loaded, result is <nil>

	// Special configuration
	Special SpecialConfig `cfg:"special"`
}

type SpecialConfig added in v0.2.0

type SpecialConfig struct {
	Host string `cfg:"host" default:"localhost"`
	Port string `cfg:"port" default:"8080"`
}

func (*SpecialConfig) String added in v0.2.0

func (c *SpecialConfig) String() string

Jump to

Keyboard shortcuts

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