sqlmancer: Count returns not the total count but the count of returned results

I mean if the limit=5 and results length is 5, count = 5 Is it intended? What I expect is count = number of filtered rows without limit

    type Order @model(table: "orders", pk: "id") {
        id: ID!
        clientId: ID!
        clientUserId: ID!
        createdAt: String
        status: String
        paymentId: String
        amount: String
        productCode: String
        quantity: String
    }

    type Query @sqlmancer(dialect: POSTGRES, transformFieldNames: SNAKE_CASE) {
        hello(name: String): String
        isAuth: AuthPayload!
        orders: Order @many @paginate
    }
        async orders(_, __, { sql, client }, info) {
            isAuth
            return client.models.Order.paginate().count().selectAll().resolveInfo(info).execute()
        },

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

I actually started working on a graphql-codegen plugin already. My intent is to replace the CLI entirely with it. The plugin could optionally generate the resolvers using the existing typescript-resolvers plugin as well to make the whole DX better.