sortee: Generate string for sort key

[ gpl, library, sorting ] [ Propose Tags ] [ Report a vulnerability ]

Please see the README on GitHub at https://github.com/b123400/sortee#readme


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1
Change log ChangeLog.md
Dependencies base (>=4.7 && <5) [details]
License GPL-3.0-only
Copyright 2019 b123400
Author b123400
Maintainer i@b123400.net
Category Sorting
Home page https://github.com/b123400/sortee#readme
Bug tracker https://github.com/b123400/sortee/issues
Source repo head: git clone https://github.com/b123400/sortee
Uploaded by b123400 at 2019-07-09T08:13:27Z
Distributions NixOS:0.1.0.1
Downloads 971 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-07-09 [all 1 reports]

Readme for sortee-0.1.0.1

[back to package description]

Sortee

A library for creating sort key, inspired by Jira's Lexorank.

Build Status

Motivation

To represent an ordered list in database, the simplest way is to assign an integer to each row. The problem though is, reordering requires updating multiple rows. Sorting by string can overcome this problem, Sortee provides a function that generates strings for sorting.

Usage

Let's say you have 3 rows, with "a" "c" "t" as sort key. To move "t" to the middle of the list, you can get the new sort key by:

between "a" "c" -- "b"

If you do not have a lower / upper reference, pass Nothing:

between Nothing "9" -- "4"
between "q" Nothing -- "v"

When there is no "space" between keys, Sortee increases the length of the string.

between "h" "i" == Sortee "hU"
between Nothing "1" == Sortee "0U"

Limitations

Not every possible input is valid.

between Nothing "0" -- Nothing
between "b" "b" -- Nothing
between "b" "b0" -- Nothing