util

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDirPerms = 0755
View Source
const DefaultFilePerms = 0660

Variables

This section is empty.

Functions

func ConvertSlice

func ConvertSlice[E any](in []any) (out []E)

Converts a list of any into a list of the given type.

From https://stackoverflow.com/a/24454401/13042236

func ExpandUserDirectory

func ExpandUserDirectory(path string) (string, error)

Expands user specific properties of a directory path. Paths which will be expanded might start with "~" or "%APPDATA%".

func SameSlice

func SameSlice[T comparable](a, b []T) bool

Checks if two slices are the same both in length and there values.

Note: this isn't tested on slices with slices in them and likely isn't accurate for that case.

func StringContains

func StringContains(haystack string, needle string) bool

Capitalization insensitive string.Contains.

func SumSlice

func SumSlice[T ~int](slice []T) T

Sums all entries of a list together.

Types

type Settings

type Settings struct {
	Verbose             bool
	IsDevelopmentBuild  bool
	UpdateInterval      uint16
	DataPath            string
	LegacyFileForImport string
	PreferredDbSavePath string
	ShowVersion         bool
}

func InitSettings

func InitSettings() Settings

Define CLI arguments and build settings from received arguments.

Jump to

Keyboard shortcuts

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