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

Add support for middleware #10

Open
Tracked by #116
RobertCraigie opened this issue Feb 5, 2021 · 1 comment
Open
Tracked by #116

Add support for middleware #10

RobertCraigie opened this issue Feb 5, 2021 · 1 comment
Labels
kind/feature A request for a new feature. level/intermediate priority/medium process/candidate Candidate for the next release
Projects
Milestone

Comments

@RobertCraigie
Copy link
Owner

https://www.prisma.io/docs/concepts/components/prisma-client/middleware

client = Client()

async def logging_middleware(params: MiddlewareParams, next: NextMiddleware) -> MiddlewareResult:
    log.info('Running %s query on %s', params.action, params.model)
    yield await next(params)
    log.info('Successfully ran %s query on %s ', params.action, params.model)

async def foo_middleware(params: MiddlewareParams, next: NextMiddleware) -> MiddlewareResult:
    ...
    result = await next(params)
    ...
    return result

client.use(logging_middleware, foo_middleware)

Should Support

  • Yielding result
  • Returning result
@RobertCraigie RobertCraigie added the kind/feature A request for a new feature. label Feb 5, 2021
@RobertCraigie RobertCraigie added this to To do in v1.0.0 via automation Feb 5, 2021
@RobertCraigie
Copy link
Owner Author

RobertCraigie commented Nov 14, 2021

We should also provide utility functions for modifying arguments.

This would make correctly implementing a feature like soft deletes easy.

I will make this a separate issue when I've designed an API proposal.

@RobertCraigie RobertCraigie added this to the v0.6.0 milestone Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for a new feature. level/intermediate priority/medium process/candidate Candidate for the next release
Projects
v1.0.0
To do
Development

No branches or pull requests

1 participant