types

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatAddress

func FormatAddress(scheme, host string, port int) string

FormatAddress creates a formatted address string from scheme, host, and port.

func INIToJSON

func INIToJSON(contents []byte) ([]byte, error)

INI/Env bytes -> JSON bytes.

func JSONToINI

func JSONToINI(contents []byte) ([]byte, error)

JSONToINI converts JSON to Systemd INI format.

func MarshalYAML

func MarshalYAML(v any) ([]byte, error)

func MergeYAML added in v0.0.2

func MergeYAML(base, override string) (string, error)

MergeYAML takes a base YAML string and an override YAML string, and returns a new YAML string with deep merge — override keys win at every level, base-only keys are preserved.

func MustMarshalYAML

func MustMarshalYAML(v any) []byte

func MustNewFileFromFS

func MustNewFileFromFS(fs embed.FS, path string) []byte

func MustUnmarshalYAML

func MustUnmarshalYAML(data []byte, v any) error

func NewIntPtr

func NewIntPtr(i int) *int

func UnmarshalYAML

func UnmarshalYAML(data []byte, v any) error

Types

type Address

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

func NewAddress

func NewAddress(address string) (Address, error)

NewAddress parses a URL-formatted address string into host and port components.

func NewAddresses

func NewAddresses(addresses []string) ([]Address, error)

NewAddresses parses multiple address strings and returns the parsed results.

func (*Address) Host

func (address *Address) Host() string

func (*Address) Port

func (address *Address) Port() int

type Format

type Format struct {
	// contains filtered or unexported fields
}
var (
	FormatYAML Format = Format{/* contains filtered or unexported fields */}
	FormatJSON Format = Format{/* contains filtered or unexported fields */}
	FormatINI  Format = Format{/* contains filtered or unexported fields */}
	FormatText Format = Format{/* contains filtered or unexported fields */}
)

type Material

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

func NewINIMaterial

func NewINIMaterial(contents []byte, path string) (Material, error)

func NewMaterial

func NewMaterial(contents any, path string, format Format) (Material, error)

func NewTextMaterial

func NewTextMaterial(contents []byte, path string) Material

func NewYAMLMaterial

func NewYAMLMaterial(contents []byte, path string) (Material, error)

func (Material) Contents

func (m Material) Contents() []byte

func (Material) FmtContents

func (m Material) FmtContents() []byte

func (Material) GetBytes

func (m Material) GetBytes(path string) ([]byte, error)

func (Material) GetStringSlice

func (m Material) GetStringSlice(path string) ([]string, error)

func (Material) IsMultiDoc added in v0.0.2

func (m Material) IsMultiDoc() bool

func (Material) Path

func (m Material) Path() string

func (Material) ToYaml

func (m Material) ToYaml() ([]byte, error)

func (Material) WithContents added in v0.0.2

func (m Material) WithContents(contents []byte) Material

WithContents returns a new Material with the given contents, preserving the path and format.

type Template

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

func MustNewTemplate

func MustNewTemplate(name string, contents []byte) *Template

func MustNewTemplateFromFS

func MustNewTemplateFromFS(fs embed.FS, path string, format Format) *Template

func NewTemplate

func NewTemplate(name string, contents []byte) (*Template, error)

func NewTemplateFromFS

func NewTemplateFromFS(fs embed.FS, path string, format Format) (*Template, error)

func (*Template) Execute

func (t *Template) Execute(w io.Writer, data any) error

func (*Template) GetName added in v0.0.2

func (t *Template) GetName() string

func (*Template) GetPath added in v0.0.2

func (t *Template) GetPath() string

Jump to

Keyboard shortcuts

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