Skip to content
\n

Is this possible for Prisma, too? I would be very handy to be able to have every instance of a model have some sort of method attached to it.

","upvoteCount":17,"answerCount":11,"acceptedAnswer":{"@type":"Answer","text":"

Hey @florianmartens 👋
\nAs Prisma is not an ORM as described here, it just returns a plain JS object on querying. So it's not possible to add methods on the model as there is no Instance, it's just a plain object that's returned.

","upvoteCount":1,"url":"https://github.com/prisma/prisma/discussions/2763#discussioncomment-26207"}}}

Is is possible to attach methods to models in Prisma? #2763

Closed Answered by ryands17
florianmartens asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @florianmartens 👋
As Prisma is not an ORM as described here, it just returns a plain JS object on querying. So it's not possible to add methods on the model as there is no Instance, it's just a plain object that's returned.

Replies: 11 comments 9 replies

Comment options

You must be logged in to vote
2 replies
@florianmartens
Comment options

@ryands17
Comment options

Answer selected by jharrell
Comment options

You must be logged in to vote
1 reply
@ryands17
Comment options

Comment options

You must be logged in to vote
3 replies
@ryands17
Comment options

@edu791
Comment options

@ryands17
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@olance
Comment options

@dcsan
Comment options

@olance
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
10 participants