Skip to content

nongdan-dev/grand-line

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GrandLine

Rust macro framework to build graphql resolvers using sea-orm and graphql-async with powerful nested filter and relationship.

GrandLine banner

Examples

use grand_line::*;
use serde_json::to_string as json;

// create the graphql input object for pagination
pagination!();

// create a sea orm model and graphql object
// id, created_at, updated_at will be inserted automatically
#[model]
pub struct Todo {
    pub content: String,
    pub done: bool,
}

// search Todo with filter, sort, pagination
#[search(Todo)]
fn resolver() {
    println!(
        "todoSearch filter={} order_by={} page={}",
        json(&filter)?,
        json(&order_by)?,
        json(&page)?,
    );
    (None, None)
}

// we can also have a custom name
// with extra filter, or default sort in the resolver as well
#[search(Todo)]
fn todoSearch2024() {
    let f = todo_filter!({
        content_starts_with: "2024",
    });
    let o = todo_order_by!([DoneAsc, ContentAsc]);
    (f, o)
}

// checkout the examples or documentation for more builtin crud and available api!

Altair screenshot

Documentation

TODO

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published