common

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 5 Imported by: 13

Documentation

Index

Constants

View Source
const (
	// If you change this here -> adjust the `New*` functions.
	BuildDebug       BuildType = 0
	BuildRelease     BuildType = 1
	BuildReleaseName           = "release"
	BuildDebugName             = "debug"
)

Variables

This section is empty.

Functions

func Cast

func Cast[T any](settings any) T

func CopySlice

func CopySlice[T any](s []T) []T

CopySlice copies a slice.

func CopySliceC

func CopySliceC[T any](s []T, capacity int) []T

CopySlice copies a slice but giving an initial capacity.

func GetEnvTypesHelp

func GetEnvTypesHelp() string

GetEnvTypesHelp reports some help string for env. types.

Types

type BuildType

type BuildType int

func GetAllBuildTypes

func GetAllBuildTypes() []BuildType

func NewBuildType

func NewBuildType(s string) (BuildType, error)

func NewBuildTypeFromEnv

func NewBuildTypeFromEnv(e EnvironmentType) BuildType

func (BuildType) MarshalYAML

func (v BuildType) MarshalYAML() (any, error)

MarshalYAML marshals to YAML. Note: needs to be value-receiver to be called!

func (*BuildType) Set

func (v *BuildType) Set(s string) (err error)

Set implement the pflags Value interface.

func (BuildType) String

func (v BuildType) String() string

String implement the pflags Value interface.

func (*BuildType) Type

func (v *BuildType) Type() string

Type implement the pflags Value interface.

func (*BuildType) UnmarshalMapstruct added in v0.26.0

func (v *BuildType) UnmarshalMapstruct(data any) error

UnmarshalMapstruct implement the [config.UnmarshalMapstruct] interface.

func (*BuildType) UnmarshalYAML

func (v *BuildType) UnmarshalYAML(unmarshal func(any) error) (err error)

UnmarshalYAML unmarshals from YAML.

type EnvironmentType

type EnvironmentType int
const (
	EnvironmentDev     EnvironmentType = 0
	EnvironmentTesting EnvironmentType = 1
	EnvironmentStaging EnvironmentType = 2
	EnvironmentProd    EnvironmentType = 3
)

func NewEnvironmentType

func NewEnvironmentType(s string) (EnvironmentType, error)

func (EnvironmentType) MarshalYAML

func (v EnvironmentType) MarshalYAML() (any, error)

MarshalYAML marshals to YAML. Note: needs to be value-receiver to be called!

func (*EnvironmentType) Set

func (v *EnvironmentType) Set(s string) (err error)

Implement the pflags Value interface.

func (EnvironmentType) ShortString

func (v EnvironmentType) ShortString() string

func (EnvironmentType) String

func (v EnvironmentType) String() string

Implement the pflags Value interface.

func (*EnvironmentType) Type

func (v *EnvironmentType) Type() string

Implement the pflags Value interface.

func (*EnvironmentType) UnmarshalMapstruct added in v0.26.0

func (v *EnvironmentType) UnmarshalMapstruct(data any) error

Implement the [config.UnmarshalMapstruct] interface.

func (*EnvironmentType) UnmarshalYAML

func (v *EnvironmentType) UnmarshalYAML(unmarshal func(any) error) (err error)

UnmarshalYAML implements the unmarshalling of this data type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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