moonbitstack/moongql/examples/24-annotations does not have a README file

    Author

    pub struct Author {
    id : Int64
    name : String
    email : String
    }

    A struct's fields become the type's fields, named in camelCase. A skipped field stays out of the schema but rides along, so a field method sees it.

    Author::to_gql

    Book

    pub struct Book {
    id : Int64
    title : String
    status : Status
    author_id : Int64
    code : String?
    }

    Hit

    pub enum Hit {
    Writer(Author)
    Title(Book)
    }

    Without fields of its own, the same enum is a union.
    impl ToGql for Hit

    Hit::to_gql

    Magazine

    pub struct Magazine {
    id : Int64
    title : String
    issue : Int
    }

    NewBook

    pub struct NewBook {
    title : String
    author_id : Int64
    status : Status?
    }

    Status

    pub enum Status {
    Draft
    Published
    } derive(Eq)

    Work

    pub enum Work {
    Printed(Book)
    Periodical(Magazine)
    }

    An enum whose constructors each wrap one #gql.type struct is an interface those structs implement, with the fields field= names; each member must have them, written the same way.

    Work::to_gql