quieres
Types
Values
pub fn bool(key: String, value: Bool) -> Query
[
quieres.int_bool("wibble", True),
quieres.int_bool("wobble", False)
]
|> quieres.format()
Turns into this:
[
#("wibble", "True"),
#("wibble", "False");
]
pub fn float(key: String, value: Float) -> Query
[
quieres.float("wibble", 1.23),
quieres.float("wobble", 45.6)
]
|> quieres.format()
Turns into this:
[
#("wibble", "1.23"),
#("wobble", "45.6"),
]
pub fn format(queries: List(Query)) -> List(#(String, String))
Format the supplied queries into a list of #(String, String) instead of a
single combined string.
Example
[
optional(quieres.int, "optional-int", option.Some(123)),
// option.None will be left out of the formatted string
optional(quieres.int, "missing-optional-int", option.None),
int_bool("int-bool-false", False),
int_bool("int-bool-true", True),
string("string", "some-string"),
bool("bool-false", False),
bool("bool-true", True),
float("float", 3.21),
int("int", 543),
]
|> format()
Gets turned into this:
[
#("optional-int", "123"),
#("int-bool-false", "0"),
#("int-bool-true", "1"),
#("string", "some-string"),
#("bool-false", "False"),
#("bool-true", "True"),
#("float", "3.21"),
#("int", "543"),
]
pub fn int(key: String, value: Int) -> Query
[
quieres.int("wibble", 123),
quieres.int("wobble", 456)
]
|> quieres.format()
Turns into this:
[
#("wibble", "123"),
#("wobble", "456"),
]
pub fn int_bool(key: String, value: Bool) -> Query
[
quieres.int_bool("wibble", True),
quieres.int_bool("wobble", False)
]
|> quieres.format()
Turns into this:
[
#("wibble", "1"),
#("wibble", "0");
]
pub fn list(
converter: fn(String, a) -> Query,
key key: String,
values values: List(a),
seperator seperator: String,
) -> Query
[
quieres.list(query.string, "wibble", ["abc", "def"], ";"),
quieres.list(query.string, "wobble", ["ghi", "jkl"], ","),
quieres.list(query.string, "wubble", [], ";"),
]
|> quieres.format()
Gets turned into this:
[
#("wibble", "abc;def"),
#("wobble", "ghi,jkl"),
]
pub fn map(query: Query, with: fn(String) -> String) -> Query
Update the value held within the query (if any) with a function.
pub fn optional(
query: fn(String, a) -> Query,
key key: String,
value value: option.Option(a),
) -> Query
[
quieres.optional(query.string, "wibble", option.Some("yeep")),
quieres.optional(query.bool, "wobble", option.None)
]
|> quieres.format()
Turns into this:
[
#("wibble", "yeep"),
]