Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 2, 2024. It is now read-only.

creating a database abstraction? decoupling mongodb #19

c-nv-s started this conversation in Ideas
Discussion options

Are there plans to decouple the mongodb dependency by abstracting the database layer?
https://github.com/upper/db
or something similar could be used to facilitate?

You must be logged in to vote

Replies: 3 comments 3 replies

Comment options

Hey @c-nv-s ,

Not in the short term, not for v1 at least.

I see the point and I also think this might be a good freedom, but it would be a major refactor at this time.

That being said, I've already started regrouping the database calls into their own package. I was expecting that would come as a request.

As I'm implementing features and doing cleanup for the v1 I'd expect to have all the database calls at one place, and at that time it would be a bit easier to add an abstraction for the database.

This might be something for v2 because it will most certainly involve lots of breaking changes. But maybe I'm wrong and once everything is in one place extracting an interface and implementing different database providers would not be as hard as it would now.

Thanks for the suggestion.

You must be logged in to vote
2 replies
Comment options

thank you.
do you have a discord or matrix chat for the project?

Comment options

Yes I've started a Discord last week, happy to see you there :)

Comment options

Hey @c-nv-s

I just wanted to let you know that a Persister interface was created and PostgreSQL support added in the last release v1.2.0.

This could also open the door to other database engine.

It's still "document" based because it's using the JSONB feature of PostgreSQL, but I think the results is very clean.

Up next is creation of indexes to optimize queries.

Let me know if that works for you.

You must be logged in to vote
0 replies
Comment options

awesome dstpierre, thanks so much for this i'll test it out when I get an opportunity.

just a note for the docker-compose files: it would make it really flexible if we could provide a DSN string for the database connections via an env variable. for example take a look at
https://github.com/kos-v/dsnparser
https://github.com/xo/dburl

this would allow users to better specify where the database is.

You must be logged in to vote
1 reply
Comment options

Yep, the env is named DATABASE_URL - all required variables can be found in the .demo.env

It's more of a connection string than a DSN. I think it could be nice to use URL-like for specifying database connection strings option, maybe introducing another env variable like DATABASE_CONN_STRING for provider's specific connection string format. And leave the DATABASE_URL for URL-like database DSN.

I'll create an issue for this. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /