左联接只是使用联接怪兽获取数据的一种方法吗?

时间:2019-02-05 13:02:01

标签: graphql

const QueryRoot = new GraphQLObjectType({
  name: 'Query',
  fields: () => ({
    getContentDetails: {
      type: new GraphQLList(Films),
      args: {
        id: {
          type: GraphQLInt
        },
        permalink: {
            type: GraphQLString
        },
        studio_id: {
            type: GraphQLString
        },
        content_types_id: {
            type: GraphQLString
        }
      },

      where: (filmTable, args, context) => {
            return ` ${filmTable}.permalink = "${args.permalink}" and ${filmTable}.content_types_id = "${args.content_types_id}"`
          },

      resolve: (parent, args, context, resolveInfo) => {
        return joinMonster.default(resolveInfo, {}, sql => {

            return FilmDb.query(sql).then(function(result) {

                return result[0];
              });

        },{dialect: 'mysql'});
      }
    }
  })
})

0 个答案:

没有答案