mod keyed;
mod unkeyed;
use crate::generators::rust::model::Field;
pub(super) use keyed::{find, remove, update};
pub(super) use unkeyed::{create, create_empty, list};
fn parameter(key: &Field) -> String {
format!(
"\x20 params(\n\
\x20 (\"{ident}\" = {ty}, Path, description = \"The row's key\"),\n\
\x20 ),\n",
ident = key.ident,
ty = owned_key(key.key_type())
)
}
pub(super) fn owned_key(rust: &str) -> String {
rust.strip_prefix("Option<")
.and_then(|rest| rest.strip_suffix('>'))
.unwrap_or(rust)
.to_string()
}
const NOT_FOUND: &str = "\x20 (status = 404, description = \"No such row\"),\n";