Documentation
¶
Index ¶
- func As[T any](value any, fallback T) T
- func AsStringMap(value any) (map[string]any, bool)
- func Capitalize(s string) string
- func Collect[T any](value any, mapper func(any) T) []T
- func CompareAddresses(a, b string) int
- func CompareSubnets(a, b string) int
- func EnsurePrefix(s, prefix string) string
- func FilePathMatches(relativePath, rootPath string) bool
- func Fingerprint(values ...any) uint64
- func FromPtr[T any](ptr *T) T
- func GetImageMimeType(ext string) string
- func LookupEnvOrFile(name string) (value string, found, fromFile bool)
- func NormalizeRelativePath(input string) (string, error)
- func ParseBool(value string) (bool, bool)
- func ParseOrDefault[T any](value string, defaultValue T, parse func(string) (T, error)) T
- func RandomString(length int) string
- func SHA256Hex[T string | []byte](s T) string
- func SQLitePathFromDSN(dsn string) (string, error)
- func SanitizeBrowsePath(input string) (string, error)
- func SnakeCase(s string) string
- func Ternary[T any](condition bool, trueVal, falseVal T) T
- func ToString(v any) string
- func TrimNonEmpty(values []string) []string
- func TrimQuotes(s string) string
- func Unique[S ~[]E, E comparable](items S) S
- func ValidateFileName(name string) (string, error)
- func WriteRecord(w io.Writer, fields ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsStringMap ¶
AsStringMap converts any map with string or interface keys, including named map types, to map[string]any. Entries whose key is not a string are dropped. The second result is false when value is not such a map.
func Collect ¶
Collect maps value through mapper, treating any slice or array as its elements and anything else (including []byte) as a single item. A nil value yields nil.
func CompareAddresses ¶
CompareAddresses orders IP address strings numerically, ignoring any CIDR suffix. Empty values sort first and malformed values last in string order.
func CompareSubnets ¶
CompareSubnets orders CIDR strings by masked network address, then prefix length. Empty values sort first and malformed values last in string order.
func EnsurePrefix ¶
EnsurePrefix trims s and returns it unchanged when it already starts with prefix, otherwise prefix+s.
func FilePathMatches ¶
FilePathMatches reports whether relativePath is rootPath or lies beneath it.
func Fingerprint ¶
Fingerprint returns an order-sensitive FNV-1a hash of values for change detection. Strings are NUL-terminated, integers varint-encoded, time.Time hashed by UnixNano, nil pointers tagged absent and non-nil ones present plus the value, slices and arrays prefixed by length, structs walked by exported field, and maps hashed in sorted key order. It is not collision resistant and must never back a security decision.
func FromPtr ¶
func FromPtr[T any](ptr *T) T
FromPtr returns the pointed-to value, or T's zero value if ptr is nil.
func GetImageMimeType ¶
func LookupEnvOrFile ¶ added in v0.6.0
LookupEnvOrFile is os.LookupEnv with Docker secret support: when NAME__FILE or NAME_FILE (checked in that order) names a readable file, its trimmed contents stand in for NAME. An unreadable file falls back to NAME. The booleans report whether a value was found and whether it came from a file.
func NormalizeRelativePath ¶
NormalizeRelativePath validates and cleans a slash-delimited path rooted at a managed file tree. The result never begins with a slash or escapes the root.
func ParseBool ¶
ParseBool recognizes true/1/yes/on and false/0/no/off, ignoring case and whitespace. The second result reports whether the value is recognized.
func ParseOrDefault ¶
ParseOrDefault parses value using parse, falling back to defaultValue when empty or unparseable.
func RandomString ¶
RandomString returns length URL-safe base64 characters drawn from crypto/rand.
func SQLitePathFromDSN ¶
SQLitePathFromDSN returns the filesystem portion of a SQLite file DSN. "file:data/arcane.db?..." carries the path in Opaque, "file:/abs/path.db" in Path.
func SanitizeBrowsePath ¶
SanitizeBrowsePath cleans a path within a rooted file browser to an absolute form, rejecting traversal above the root.
func SnakeCase ¶
SnakeCase lower-cases s, inserting an underscore before every upper-case rune after the first.
func TrimNonEmpty ¶
TrimNonEmpty trims every entry and drops the blank ones, preserving order.
func TrimQuotes ¶
TrimQuotes removes one matching pair of surrounding double or single quotes.
func Unique ¶
func Unique[S ~[]E, E comparable](items S) S
Unique returns the distinct items in first-seen order, or nil when items is empty.
func ValidateFileName ¶
ValidateFileName validates a single file-tree path segment.
func WriteRecord ¶
WriteRecord writes fields NUL-separated and newline-terminated, for stable content hashes.
Types ¶
This section is empty.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
acfs
module
|
|
|
builds
module
|
|
|
Package capture provides a bounded, concurrency-safe capture buffer for streamed output such as build or process logs.
|
Package capture provides a bounded, concurrency-safe capture buffer for streamed output such as build or process logs. |
|
docker
module
|
|
|
convert
module
|
|
|
Package fs contains focused filesystem helpers shared by Arcane Go modules.
|
Package fs contains focused filesystem helpers shared by Arcane Go modules. |
|
atomic
Package atomic provides crash-safe atomic file writes at an absolute path.
|
Package atomic provides crash-safe atomic file writes at an absolute path. |
|
Package git provides helpers for recognizing and normalizing Git repository URLs across the schemes Git supports (scp-like git@, git, ssh, http, and https).
|
Package git provides helpers for recognizing and normalizing Git repository URLs across the schemes Git supports (scp-like git@, git, ssh, http, and https). |
|
Package mapping deep-copies between structurally similar types, converting netip values to and from their string form along the way.
|
Package mapping deep-copies between structurally similar types, converting netip values to and from their string form along the way. |
|
Package normalization applies opt-in Unicode NFC and whitespace normalization.
|
Package normalization applies opt-in Unicode NFC and whitespace normalization. |
|
Package registry canonicalizes container registry hosts so that image references and credential lookups agree on what "the same registry" means.
|
Package registry canonicalizes container registry hosts so that image references and credential lookups agree on what "the same registry" means. |
|
sys
|
|
|
bytes
Package bytes implements functionality for working with byte sizes.
|
Package bytes implements functionality for working with byte sizes. |
|
cgroup
module
|
|
|
tripwire
module
|
|
|
updater
module
|
|
|
Package utils provides focused helpers for working with string slices whose entries may be blank.
|
Package utils provides focused helpers for working with string slices whose entries may be blank. |