Sort special characters before numbers (#3829)

* Sort special characters before numbers (via local dep change)
This commit is contained in:
WithoutPants 2023-06-22 09:51:21 +10:00 committed by GitHub
parent 873d4dade6
commit 0087bc941c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 13 deletions

2
go.mod
View File

@ -9,7 +9,6 @@ require (
github.com/chromedp/chromedp v0.7.3
github.com/corona10/goimagehash v1.0.3
github.com/disintegration/imaging v1.6.0
github.com/fvbommel/sortorder v1.1.0
github.com/go-chi/chi v4.0.2+incompatible
github.com/golang-jwt/jwt/v4 v4.0.0
github.com/golang-migrate/migrate/v4 v4.15.0-beta.1
@ -45,6 +44,7 @@ require (
)
require (
github.com/WithoutPants/sortorder v0.0.0-20230616003020-921c9ef69552
github.com/asticode/go-astisub v0.20.0
github.com/doug-martin/goqu/v9 v9.18.0
github.com/go-chi/cors v1.2.1

4
go.sum
View File

@ -71,6 +71,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/RoaringBitmap/roaring v0.4.7/go.mod h1:8khRDP4HmeXns4xIj9oGrKSz7XTQiJx2zgh7AcNke4w=
github.com/WithoutPants/sortorder v0.0.0-20230616003020-921c9ef69552 h1:eukVk+mGmbSZppLw8WJGpEUgMC570eb32y7FOsPW4Kc=
github.com/WithoutPants/sortorder v0.0.0-20230616003020-921c9ef69552/go.mod h1:LKbO1i6L1lSlwWx4NHWVECxubHNKFz2YQoEMGXAFVy8=
github.com/Yamashou/gqlgenc v0.0.6 h1:wfMTtuVSrX2N1z5/ssecxx+E7l1fa0FOq5mwFW47oY4=
github.com/Yamashou/gqlgenc v0.0.6/go.mod h1:WOXjogecRGpD1WKgxnnyHJo0/Dxn44p/LNRoE6mtFQo=
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
@ -233,8 +235,6 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw=
github.com/fvbommel/sortorder v1.1.0 h1:fUmoe+HLsBTctBDoaBwpQo5N+nrCp8g/BjKb/6ZQmYw=
github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=

View File

@ -5,7 +5,7 @@ import (
"database/sql/driver"
"fmt"
"github.com/fvbommel/sortorder/casefolded"
"github.com/WithoutPants/sortorder/casefolded"
sqlite3 "github.com/mattn/go-sqlite3"
)

View File

@ -73,9 +73,7 @@ func NaturalLess(str1, str2 string) bool {
dig1, dig2 := isDigit(c1), isDigit(c2)
switch {
case dig1 != dig2: // Digits before other characters.
return dig1 // True if LHS is a digit, false if the RHS is one.
case !dig1: // && !dig2, because dig1 == dig2
case !dig1 || !dig2:
// For ASCII it suffices to normalize letters to upper-case,
// because upper-cased ASCII compares lexicographically.
// Note: this does not account for regional special cases
@ -132,9 +130,7 @@ hasUnicode:
dig1, dig2 := isDigit(c1), isDigit(c2)
switch {
case dig1 != dig2: // Digits before other characters.
return dig1 // True if LHS is a digit, false if the RHS is one.
case !dig1: // && !dig2, because dig1 == dig2
case !dig1 || !dig2:
idx1 += delta1
idx2 += delta2
// Fast path: identical runes are equal.

6
vendor/modules.txt vendored
View File

@ -24,6 +24,9 @@ github.com/99designs/gqlgen/plugin/federation/fieldset
github.com/99designs/gqlgen/plugin/modelgen
github.com/99designs/gqlgen/plugin/resolvergen
github.com/99designs/gqlgen/plugin/servergen
# github.com/WithoutPants/sortorder v0.0.0-20230616003020-921c9ef69552
## explicit; go 1.13
github.com/WithoutPants/sortorder/casefolded
# github.com/Yamashou/gqlgenc v0.0.6
## explicit; go 1.16
github.com/Yamashou/gqlgenc
@ -143,9 +146,6 @@ github.com/doug-martin/goqu/v9/sqlgen
# github.com/fsnotify/fsnotify v1.5.1
## explicit; go 1.13
github.com/fsnotify/fsnotify
# github.com/fvbommel/sortorder v1.1.0
## explicit; go 1.13
github.com/fvbommel/sortorder/casefolded
# github.com/go-chi/chi v4.0.2+incompatible
## explicit
github.com/go-chi/chi