1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-04-20 06:54:46 +00:00

add search method

This commit is contained in:
Dominic 2019-10-13 17:43:42 +02:00
parent 8429c425aa
commit 0153b2e22f
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
8 changed files with 84 additions and 13 deletions

View file

@ -36,6 +36,13 @@ pub fn rest_read(attr : TokenStream, item : TokenStream) -> TokenStream
output
}
#[proc_macro_attribute]
pub fn rest_search(attr : TokenStream, item : TokenStream) -> TokenStream
{
let output = expand_method(Method::Search, attr, item);
output
}
#[proc_macro_attribute]
pub fn rest_create(attr : TokenStream, item : TokenStream) -> TokenStream
{

View file

@ -13,6 +13,7 @@ pub enum Method
{
ReadAll,
Read,
Search,
Create,
UpdateAll,
Update,
@ -28,6 +29,7 @@ impl FromStr for Method
match str {
"ReadAll" | "read_all" => Ok(Self::ReadAll),
"Read" | "read" => Ok(Self::Read),
"Search" | "search" => Ok(Self::Search),
"Create" | "create" => Ok(Self::Create),
"UpdateAll" | "update_all" => Ok(Self::UpdateAll),
"Update" | "update" => Ok(Self::Update),
@ -47,6 +49,7 @@ impl Method
let name = match self {
ReadAll => "ReadAll",
Read => "Read",
Search => "Search",
Create => "Create",
UpdateAll => "UpdateAll",
Update => "Update",
@ -63,6 +66,7 @@ impl Method
let name = match self {
ReadAll => "read_all",
Read => "read",
Search => "search",
Create => "create",
UpdateAll => "update_all",
Update => "update",