Derive Macro for rust

Hi folks,

I’m Sevki, I’m new here. I have been searching for a more rusty™️ way to generate schemas.

something like,

#[derive(Relation)]
enum Employment {
    #[role]
    Employee,
    #[role]
    Employer,
}

// Rust code
#[derive(Entity)]
#[abs]
pub struct Person {
    #[key]
    email: String,
    #[owns]
    full_name: String,
    #[owns]
    age: i32,
    #[plays(Employment::Employee)]
    employment: Option<Employment>,
}

I have started to try and build something like this, would be happy to share it with people if they can see any value in it.

The derive bits as you can imagine are quite straight forward.

What I am currently working on is

#[derive(QueryAnswers)]
#[query("match $person isa person, has name $name, has age $age;")]
struct PersonQuery;

which will generate a

struct PersonAnswer {
    name: String,
    age: i64,
}

#[derive(Debug, Clone)]
enum PersonError {
    InvalidName,
    InvalidAge,
}

impl TryFrom<ConceptRow> for PersonAnswer {
    type Error = PersonError;

    fn try_from(value: ConceptRow) -> Result<Self, Self::Error> {
        Ok(Self {
            name: value
                .get("name")
                .unwrap()
                .unwrap()
                .try_get_string()
                .unwrap()
                .into(),
            age: value
                .get("age")
                .map_err(|_| PersonError::InvalidAge)?
                .ok_or(PersonError::InvalidAge)?
                .try_get_integer()
                .unwrap(),
        })
    }
} 

So my question is, I’m really really new to typedb and would like to contribute somehthing like this, if anyone wants to help me onboard and mentor me on landing this.

cheers,

s.