Skip to content
gosudaPublic

About

Schottky: A flexible sort-key encoding library

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Schottky

Schottky encodes typed values and composite tuples so unsigned bytewise key order matches the declared value order.

Properties

  • Caller-owned encoding and decoding buffers
  • Allocation-free hot path when capacity is sufficient
  • Independent ascending or descending order and null placement per field
  • Literal complete-field prefixes for prefix filters and range scans
  • Scalar and nested encodings for modern SQL data
  • No third-party dependencies
  • Optional Go 1.27 portable SIMD byte transforms

Example

storage := make([]byte, 0, 128)
builder := schottky.NewBuilder(storage)
builder.Int64(42, schottky.AscNullsLast)
accountPrefix := builder.Len()
builder.String("Ada", schottky.DescNullsFirst)

key, err := builder.Key()
if err != nil {
	return err
}
prefix := key[:accountPrefix]

Builder never grows storage. Insufficient capacity returns schottky.ErrShortBuffer without partially appending a field.

Start with the key layout, Go API, SQL type map, format compatibility guide, and utf8mb4 collation map.

Enable the experimental SIMD path with GOEXPERIMENT=simd on Go 1.27. Scalar and SIMD builds emit identical keys.

About

Schottky: A flexible sort-key encoding library

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages