Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client): add more jsdoc to Prisma Client #4388

Merged
merged 12 commits into from
Dec 17, 2020

Conversation

williamluke4
Copy link
Contributor

@williamluke4 williamluke4 commented Nov 27, 2020

closes #4344

  • Aggregate{Model}Args
    • where
    • orderBy
    • cursor
    • take
    • skip
    • count
    • avg
    • sum
    • min
    • max
  • FindFirst{Model}Args
    • orderBy
    • cursor
    • take
    • skip
    • distinct
  • {Model}UpdateManyArgs
    • data
    • where
  • DeleteManyArgs
    • where
  • {Model}Delegate.count()
  • {Model}Delegate.aggregate()

@williamluke4 williamluke4 force-pushed the williamluke4/issue4344 branch 3 times, most recently from e17bbf0 to 2adfbe3 Compare December 2, 2020 08:05
@williamluke4 williamluke4 force-pushed the williamluke4/issue4344 branch 4 times, most recently from eaa1189 to 267effa Compare December 9, 2020 10:01
@williamluke4 williamluke4 added this to the 2.14.0 milestone Dec 9, 2020
@williamluke4 williamluke4 marked this pull request as ready for review December 9, 2020 14:34
@@ -115,7 +115,10 @@ export class Model implements Generatable {
export type ${groupByArgsName} = {
${indent(
groupByRootField.args
.map((arg) => new InputField(arg, false, arg.name === 'by').toTS())
.map((arg) => {
arg.comment = getArgFieldJSDoc(model, DMMF.ModelAction.groupBy, arg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you build that into InputField?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have done that but it would take a while to implement

: ''
}: Subset<T, ${getModelArgName(name, actionName)}>
${actionName}${getGenericMethod(name, actionName)}(
${getArgs(name, actionName)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did the conditions go?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

into getArgs

@williamluke4 williamluke4 force-pushed the williamluke4/issue4344 branch 3 times, most recently from 01ed01c to 9ba457c Compare December 10, 2020 13:23
cursor?: PostWhereUniqueInput
/**
* The number of Posts to aggregate. If negative number, it will take Posts before the \`cursor\`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will actually take the cursor too in results without skip: 1

So we need to find a better wording because "before" makes me think the cursor is not included but it is and you need to pass skip: 1 to exclude it

Example from docs

Example: Paging backwards with cusor-based pagination

To page backwards, set take to a negative value. The following query returns 4 Post records with an id of less than 200, excluding the cursor:

const myOldCursor = 200
const firstQueryResults = prisma.post.findMany({
  take: -4,
  skip: 1,
  cursor: {
    id: myOldCursor,
  },
  where: {
    title: {
      contains: 'Prisma' /* Optional filter */,
    },
  },
})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Takes n Posts from the position of the cursor, including the cursor?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Takes n Posts from the position of the cursor, cursor included. maybe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed it to

Take \`n\` Posts from the position of the cursor (cursor included). If negative number, it will take Posts before the \`cursor\`.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the cursor is always included from what I understand.
This suggests the cursor is included only in one case

@williamluke4 williamluke4 force-pushed the williamluke4/issue4344 branch 3 times, most recently from 2e2c8be to f8bb1fe Compare December 11, 2020 08:15
@timsuchanek timsuchanek merged commit 02e8011 into master Dec 17, 2020
@timsuchanek timsuchanek deleted the williamluke4/issue4344 branch December 17, 2020 10:05
Jolg42 added a commit that referenced this pull request Dec 28, 2020
* master:
  fix(deps): update engines to v2.14.0-26.59cf08bf47e90cb37532900059f3328b4328237c (#4774)
  chore(deps): update definitelytyped
  fix(client): raw transactions (#4759)
  fix(deps): update engines to v2.14.0-22.85cf7930a5fc63cd99fa483153fd33cb35d49cfa
  chore(deps): update studio to v0.332.0
  fix(client): improve error links (#4753)
  fix(deps): update engines to v2.14.0-21.aed47bccd0e3bc61e2a26b14315e2dd839d35a12
  chore: bump engines (#4749)
  fix: fail early for known errors (#4734)
  chore: cleanup (#4707)
  fix(debug): allow multiple instances (#4665)
  chore: wip debug vercel (#4705)
  fix(deps): update engines to v2.14.0-17.af950b3705ef175e85492660c621085eb7f99557
  chore(deps): update dependency rollup-plugin-dts to v2 (#4323)
  feat(client): add more jsdoc to Prisma Client (#4388)
  fix(deps): update engines to v2.14.0-16.c033861e8ed093701af214a25e2bb3e03edacf7c

# Conflicts:
#	package.json
#	pnpm-lock.yaml
#	src/packages/client/package.json
#	src/packages/client/src/runtime/getPrismaClient.ts
#	src/packages/debug/package.json
#	src/packages/engine-core/package.json
#	src/packages/generator-helper/package.json
#	src/packages/get-platform/package.json
#	src/pnpm-lock.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more jsdoc to Prisma Client
3 participants