entity_async_graphql/ent/
field.rs1use super::GqlValue;
2use async_graphql::Object;
3use derive_more::{From, Into};
4use entity::Field;
5
6#[derive(From, Into)]
8pub struct GqlField(Field);
9
10#[Object]
11impl GqlField {
12 #[graphql(name = "name")]
13 async fn gql_name(&self) -> &str {
14 self.0.name()
15 }
16
17 #[graphql(name = "value")]
18 async fn gql_value(&self) -> GqlValue {
19 GqlValue::from(self.0.value().clone())
20 }
21
22 #[graphql(name = "indexed")]
23 async fn gql_indexed(&self) -> bool {
24 self.0.is_indexed()
25 }
26
27 #[graphql(name = "immutable")]
28 async fn gql_immutable(&self) -> bool {
29 self.0.is_immutable()
30 }
31}