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: add extra sql functions #419

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

martini97
Copy link
Contributor

Background

I've been using pg-mem with TypeOrm and there are some functions required by TypeOrm which pg-mem does not implement: exists and obj_description, I've implemented them on my project with registerFunction but since they are required by the ORM and there's an adapter for it I though it would be nice to upstream it so that others don't have to implement them.

I've also included the built-in timezone function, which is not required by the ORM but I was also using it on my project.
I've included the moment-timezone package as the project already included the moment package, if you are against it let me know and I can remove it.

What this pull request does

  • Implements the exists function
  • Implements the obj_description function (I'm simply returning null, with the reason being that the comments won't affect the database, if you disagree I can implement the full functionality of storing/updating/removing comments)
  • Implements the timezone function (includes the moment-timezone package to assist with timezone manipulation)

@oguimbal oguimbal merged commit 7de1425 into oguimbal:master Oct 11, 2024
@oguimbal
Copy link
Owner

oguimbal commented Oct 11, 2024

Thanks !
I had a small issue with your commit introducing `moment-timezone'.
While it works with node/bun, it wont work with Deno since it does not exists on deno.land.
... pg-mem tries to be compatible with Deno, so I had to revert this commit.

You can however declare this function outside of pg-mem though custom functions, though

Other changes are released in [email protected]

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.

2 participants