极客时间对于推广渠道会有返利优惠,比如山月在极客时间买了一门课,再把课程分享给好友购买,这时极客时间会向山月返利20元左右。
而我现在做了一个返利平台,你可以在上边通过山月的链接购买课程,此时极客时间会向我返利。为了共同学习,而你可以添加我的微信 (shanyue94),我将把极客时间给我的返利发一个红包全部返给你

# 源码分析

# 源码

  1. 验证 Schema 的有效性
  2. 解析 Source(Operation)
  3. 执行
  • validateSchema
    • validateRootTypes
    • validateDirectives
    • validateTypes
  • parseSource
    • Source
    • Document
  • execute
    • rootType -> 可以从此获取到诸多 fields

# 执行 execute

  • execute
    • buildExecutionContext: 构建执行上下文信息,如 defaultResolver、operation 等
    • rootFields: 通过 获取到根路径的所有字段
    • executeOperation

# Query

executeFields(exeContext, rootType, rootValue, path, rootFields);
  • executeFields
    • executeField
      • source, args, contextValue, info
      • resolvFn
      • completeValue

# Mutation

executeFieldsSerially(
  exeContext,
  rootType,
  rootValue,
  path,
  rootFields,
);
  • executeFieldsSerially

# Schema

  • GraphQLSchema

  • GraphQLObjectType

  • GraphQLDirective

  • isObjectType

  • schema.getQueryType()

  • schema.getMutationType()

  • schema.getSubscriptionType()

  • schema.getDirectives()

关于山月

我的项目:
我的微信:shanyue94,欢迎交流
Last Updated: 3/3/2022, 9:04:20 AM