Interroger une liste d’entités par leur GUID.
Vous pouvez récupérer un maximum de 25 entités dans une requête.
Usage
import { EntityByGuidQuery } from 'nr1'
Exemples
Requête déclarative
<EntityByGuidQuery entityGuid={'MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzIx'}> {({ loading, error, data }) => { if (loading) { return <Spinner />; }
if (error) { return 'Error!'; }
return ( <List items={data.entities} rowHeight={20}> {({ item }) => <ListItem key={item.guid}>{item.name}</ListItem>} </List> ); }}</EntityByGuidQuery>
Requête impérative
EntityByGuidQuery.query({ entityGuid: 'MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzIx',}).then(({ data }) => console.log(data));
Accessoires
fonction | Rendre la fonction prop comme un enfant. function ( |
objet | Document fragment GraphQL analysé dans un AST par
|
OBLIGATOIREchaîne | GUID de l'entité à requêter. |
énum. | Vous permet de spécifier comment vous souhaitez que votre requête interagisse avec les données mises en cache.
|
booléen | |
booléen | Si |
nombre | Intervalle en millisecondes pour interroger de nouvelles données. Réglez à zéro pour éviter tout type d'interrogation régulière. |
booléen | Lorsqu'il est défini sur |
Méthodes
EntityByGuidQuery.query
function (props: Object Object containing the query options. Any EntityByGuidQuery
prop is a valid option except children
and pollInterval
.
) => PromiseQueryResult
Définitions de types
PromiseQueryResult
{error: ApolloClient.ApolloError, Runtime error with graphQLErrors
and networkError
properties.
data: Object, Object containing the result of your query.
fetchMore: function|null, If not null
, fetchMore
allows you to load more results for your query. New data is merged with previous data.
refetch: function, Refetch the query.
}
QueryResult
{loading: boolean, Indicates that the request is in flight.
error: ApolloClient.ApolloError, Runtime error with graphQLErrors
and networkError
properties.
data: Object, Object containing the result of your query.
fetchMore: function|null, If not null
, fetchMore
allows you to load more results for your query. New data is merged with previous data.
refetch: function, Refetch the query.
}