[][src]Derive Macro wundergraph::WundergraphEntity

#[derive(WundergraphEntity)]
{
    // Attributes available to this derive:
    #[wundergraph]
    #[table_name]
    #[primary_key]
}

A custom derive to implement all wundergraph related traits for a entity Using this trait implies internally #[derive(WundergraphBelongsTo)] and #[derive(BuildFilterHelper)]

Type attributes

  • Required:
    • #[table_name = "diesel_table_mod"]: Name of the underlying diesel table.
  • Optional:
    • #[primary_key(primary_key_name)]: Names the fields that represent the primary key on the underlying database table. Set to id if not given (In this case a primary key field named id must exist)
    • /// Documentation/#[doc = "Documentation"]: Set as GraphQL description text.

Field attributes

All attributes are optional. If no attributes are given the field name needs to match the name of the field in the corresponding diesel table! and is used a GraphQL field name

  • #[column_name = "other_name"]: Use the given name instead of the field name as column name for calling into diesels table!
  • #[wundergraph(graphql_name = "Foo")]: Set the GraphQL name of the field to the given name. If not set the field name is used as name.
  • #[deprecated(note = "Some Text")]: Set as GraphQL deprecation notice
  • /// Documentation/#[doc = "Documentation"]: Set as GraphQL description text.