sort

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package sort provides natural sorting for migration versions. Natural sorting treats numeric parts as numbers, not strings. For example: "1" < "2" < "10" < "100"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b string) int

Compare compares two version strings using natural sort order. Returns:

-1 if a < b
 0 if a == b
+1 if a > b

Examples:

Compare("1", "2") = -1
Compare("10", "2") = 1
Compare("v1", "v10") = -1
Compare("user_001", "user_002") = -1

Types

This section is empty.

Jump to

Keyboard shortcuts

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