#config-parser #questdb #parser #key2-value2 #key1-value1

questdb-confstr

A parser for a configuration string format handling service names and parameters

2 releases

new 0.1.1 Apr 4, 2025
0.1.0 Jan 31, 2024

#107 in Configuration

Download history 1425/week @ 2024-12-15 4341/week @ 2024-12-22 2816/week @ 2024-12-29 1102/week @ 2025-01-05 3006/week @ 2025-01-12 3805/week @ 2025-01-19 3951/week @ 2025-01-26 4978/week @ 2025-02-02 5140/week @ 2025-02-09 5100/week @ 2025-02-16 4921/week @ 2025-02-23 5011/week @ 2025-03-02 4641/week @ 2025-03-09 3678/week @ 2025-03-16 3298/week @ 2025-03-23 3658/week @ 2025-03-30

15,949 downloads per month
Used in 2 crates

Apache-2.0

15KB
292 lines

questdb-confstr

Format

Parser for a configuration string format used by QuestDB clients.

The format is as follows:

service::key1=value1;key2=value2;key3=value3;

A few rules:

  • The last semicolon is optional.
  • Service name and keys are case-sensitive.
  • Keys are ASCII alphanumeric and can contain underscores.
  • Values are case-sensitive unicode strings which can contain any characters,
    • Except control characters (0x00..=0x1f and 0x7f..=0x9f).
    • If semicolons ; appears in a value, these are escaped as double semicolon ;;.

Grammar

conf_str ::= service "::" params | service
service ::= identifier
params ::= param (";" param)* ";"?
param ::= key "=" value
key ::= identifier
value ::= { value_char }

identifier ::= alpha_num_under { alpha_num_under }
alpha_num_under ::= "a".."z" | "A".."Z" | "0".."9" | "_"
value_char ::= non_semicolon_char | escaped_semicolon
escaped_semicolon ::= ";;"
non_semicolon_char ::= ? any unicode character except ';', 0x00..=0x1f and 0x7f..=0x9f ?

Usage

Add dependency to Cargo.toml

cargo add questdb-confstr

Usage

Use the parse_conf_str function to parse into a ConfStr struct.

You can then access the service name as &str and parameters as a &HashMap<String, String>.

Where we use it

We use this config parsing format in our Rust, C, C++ and Python clients.

We also use it to configure object stores for database replication.

No runtime deps