<commit_before># Sort String To SQL

This is a rust crate to convert 'sort expressions' to SQL expressions that can be used in an 'ORDER BY'. E.g., `-date,id` will be converted `date DESC NULLS LAST, id ASC NULLS LAST`.

It can be used to parse a query parameter for sorting and to easily convert it to an expression that can be used in an SQL query.

I'm only using this with Postgres myself, so I can't promise you it will work with other databases.

[![Build Status](https://travis-ci.org/killercup/rust-sortStringToSql.svg)](https://travis-ci.org/killercup/rust-sortStringToSql)

```toml
# Cargo.toml
[dependencies.toml]
git = "https://github.com/killercup/rust-sortStringToSql"
```

## Input Format

Comma separated list of field names. Prepend a '-' for descending order or a '+' dor ascending order (which is the default, so it's optional). Append a '-' if you want records with `null` values first (this sets `NULLS FIRST`).

You can find some examples in `test.js`.

## License

MIT<commit_msg>Fix dependency name in cargo usage example.<commit_after># Sort String To SQL

This is a rust crate to convert 'sort expressions' to SQL expressions that can be used in an 'ORDER BY'. E.g., `-date,id` will be converted `date DESC NULLS LAST, id ASC NULLS LAST`.

It can be used to parse a query parameter for sorting and to easily convert it to an expression that can be used in an SQL query.

I'm only using this with Postgres myself, so I can't promise you it will work with other databases.

[![Build Status](https://travis-ci.org/killercup/rust-sortStringToSql.svg)](https://travis-ci.org/killercup/rust-sortStringToSql)

```toml
# Cargo.toml
[dependencies.sort_str_to_sql]
git = "https://github.com/killercup/rust-sortStringToSql"
```

## Input Format

Comma separated list of field names. Prepend a '-' for descending order or a '+' dor ascending order (which is the default, so it's optional). Append a '-' if you want records with `null` values first (this sets `NULLS FIRST`).

You can find some examples in `test.js`.

## License

MIT
{'fraction_non_alphanumeric': 0.10014655593551539, 'fraction_numerical': 0.0, 'mean_word_length': 4.224489795918367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6086451', 'n_tokens_mistral': 638, 'n_tokens_neox': 615, 'n_words': 281}