utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package utils ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapKeysSortedByKey added in v1.0.1

func MapKeysSortedByKey[T, U constraints.Ordered](m map[T]U) []T

MapKeysSortedByKey returns a sorted slice of the map's keys. Keys and values need to satisfy constraints.Ordered.

func MapKeysSortedByValue added in v1.0.1

func MapKeysSortedByValue[T, U constraints.Ordered](m map[T]U) []T

MapKeysSortedByValue returns a slice containing the map's keys sorted by map value. Keys and values need to satisfy constraints.Ordered.

func ReadFloats

func ReadFloats(path string) ([]float64, error)

ReadInts reads a list of integers from a file.

func ReadInts

func ReadInts(path string) ([]int, error)

ReadInts reads a list of integers from a file.

func ReadObject

func ReadObject[T any](path string) (T, error)

ReadObject reads a json serialized object from a file.

func ReadString

func ReadString(path string) (string, error)

ReadString reads a string from a file.

func WriteFloats

func WriteFloats(path string, floats []float64) error

WriteFloats writes a list of float64s to a file.

func WriteInts

func WriteInts(path string, ints []int) error

WriteInts writes a list of integers to a file.

func WriteObject

func WriteObject(path string, obj any) error

WriteObject writes an object to a file as json.

func WriteString

func WriteString(path, value string) error

WriteString writes a string to a file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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