util

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDuration added in v0.25.0

func FormatDuration(millis int64) string

FormatDuration renders a millisecond duration as a coarse, single-unit, at-a-glance string (e.g. "just now", "5m", "3h", "2 days", "4 months"). Used for "how long in this column" displays where precision isn't the point.

func FormatMillis

func FormatMillis(millis int64) string

FormatMillis formats milliseconds since epoch in a human-readable way.

func FormatTime

func FormatTime(t time.Time) string

FormatTime formats a time in a human-readable way.

func MillisToTime

func MillisToTime(millis int64) time.Time

MillisToTime converts milliseconds since Unix epoch to time.Time.

func NowMillis

func NowMillis() int64

NowMillis returns the current time in milliseconds since Unix epoch.

func PositionAfter added in v0.21.0

func PositionAfter(a string) string

PositionAfter returns a position that sorts after a. Shorthand for PositionBetween(a, "").

func PositionBefore added in v0.21.0

func PositionBefore(a string) string

PositionBefore returns a position that sorts before a. Shorthand for PositionBetween("", a).

func PositionBetween added in v0.21.0

func PositionBetween(a, b string) string

PositionBetween returns a position that sorts between a and b.

Pass "" for a to get a position before b (prepend to start of list). Pass "" for b to get a position after a (append to end of list). Both a and b empty returns a default starting position.

When both are provided, a must sort before b (a < b).

func PositionInitial added in v0.21.0

func PositionInitial(n int) []string

PositionInitial generates n evenly-spaced position strings. Useful for assigning initial positions when migrating existing card orderings.

func SlugWords added in v0.14.0

func SlugWords(s string) []string

SlugWords converts a string to normalized slug words.

  • Converts to lowercase
  • Normalizes unicode (removes accents)
  • Replaces spaces and special characters with hyphens
  • Splits on hyphens into individual words

The caller is responsible for joining/truncating as needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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