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:
parent
8429c425aa
commit
0153b2e22f
8 changed files with 84 additions and 13 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue