当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript graphql-anywhere.default函数代码示例

本文整理汇总了TypeScript中graphql-anywhere.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: diffQueryAgainstStore

export function diffQueryAgainstStore({
  store,
  query,
  variables,
  returnPartialData = true,
  config,
}: ReadQueryOptions): DiffResult {
  // Throw the right validation error by trying to find a query in the document
  getQueryDefinition(query);

  const context: ReadStoreContext = {
    // Global settings
    store,
    returnPartialData,
    customResolvers: config && config.customResolvers,

    // Flag set during execution
    hasMissingField: false,
  };

  const rootIdValue = {
    type: 'id',
    id: 'ROOT_QUERY',
  };

  const result = graphqlAnywhere(readStoreResolver, query, rootIdValue, context, variables, {
    fragmentMatcher,
  });

  return {
    result,
    isMissing: context.hasMissingField,
  };
}
开发者ID:drager,项目名称:apollo-client,代码行数:34,代码来源:readFromStore.ts

示例2: diffQueryAgainstStore

export function diffQueryAgainstStore({
  store,
  query,
  variables,
  previousResult,
  returnPartialData = true,
  rootId = 'ROOT_QUERY',
  fragmentMatcherFunction,
  config,
}: DiffQueryAgainstStoreOptions): DiffResult {
  // Throw the right validation error by trying to find a query in the document
  const queryDefinition = getQueryDefinition(query);

  variables = assign({}, getDefaultValues(queryDefinition), variables);

  const context: ReadStoreContext = {
    // Global settings
    store,
    returnPartialData,
    customResolvers: (config && config.customResolvers) || {},

    // Flag set during execution
    hasMissingField: false,
  };

  const rootIdValue = {
    type: 'id',
    id: rootId,
    previousResult,
  };

  const result = graphqlAnywhere(
    readStoreResolver,
    query,
    rootIdValue,
    context,
    variables,
    {
      fragmentMatcher: fragmentMatcherFunction,
      resultMapper,
    },
  );

  return {
    result,
    isMissing: context.hasMissingField,
  };
}
开发者ID:hammadj,项目名称:apollo-client,代码行数:48,代码来源:readFromStore.ts


注:本文中的graphql-anywhere.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。