common

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 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)

Implement the pflags Value interface.

func (BuildType) String

func (v BuildType) String() string

Implement the pflags Value interface.

func (*BuildType) Type

func (v *BuildType) Type() string

Implement the pflags Value interface.

func (*BuildType) UnmarshalYAML

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

UnmarshalYAML unmarshals from YAML.

type Credentials

type Credentials struct {
	// contains filtered or unexported fields
}

func NewCredentials

func NewCredentials(envs CredentialsEnv) (c Credentials, err error)

NewCredentials returns new credentials from env. variables.

func NewCredentialsTokenOnly

func NewCredentialsTokenOnly(tokenEnv string) (c Credentials, err error)

NewCredentialsTokenOnly creates credentials only for the token (user is `quitsh`).

func (Credentials) Token

func (c Credentials) Token() string

func (Credentials) User

func (c Credentials) User() string

type CredentialsEnv

type CredentialsEnv struct {
	UserEnv  string `yaml:"userEnv"`
	TokenEnv string `yaml:"tokenEnv"`
}

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) 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