qs
Types
pub type QueryBasic =
Query(List(String))
Functions
pub fn delete(
query: Dict(String, a),
key: String,
) -> Dict(String, a)
Delete a key from the query
pub fn get(
query: Dict(String, a),
key: String,
) -> Result(a, String)
Get values from the query
pub fn has_key(query: Dict(String, a), key: String) -> Bool
Tell if the query has the given key
pub fn insert(
query: Dict(String, a),
key: String,
value: a,
) -> Dict(String, a)
Insert a value in the query Replaces existing values
pub fn merge(
a: Dict(String, a),
b: Dict(String, a),
) -> Dict(String, a)
Merge two Querys. Second query takes precedence.
pub fn parse(
qs: String,
) -> Result(Dict(String, List(String)), String)
Parse a query string. Values that cannot be parsed are ignored.
Example
"?color=red&tags=large&tags=wool"
|> qs.parse
==
Ok(
dict.from_list(
[ #("color", ["red"]), #("tags", ["large", "wool"]) ]
)
)