-
Notifications
You must be signed in to change notification settings - Fork 111
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
feature add bun orm lib to simplify data access #480
Conversation
…witch between old and new version
# Conflicts: # go.mod # go.sum # internal/db/psqluserdb.go # internal/db/sqlite3userdb.go
@evrins , I am not comfortable with using ORM for DBs in exatorrent. It would bloat the binary size and I prefer SQL and not the ORM abstraction. (I hold the opinion that ORMs are bad. Lot of bugs and complexity arises from ORMs and it gets hard to debug. That's why I've avoided it at first place when I was developing. And I still hold this opinion) I just tested your branch right now. Changes you've made has bloated the binary by 2MB on Linux. Not worth it if the changes don't add any features. But, sqliteshim which automatically imports SQL libs seem to be interesting. And to be honest, I did reject the modernc sqlite driver during the development of sqlite. For the Sqlite, i think that it would be better to stick with https://github.com/go-llsqlite/crawshaw (see crawshaw's article on this) or mattn-sqlite. For the CGo less port, I would prefer some Golang Keyval Datastore libs (no boltdb please!) Also, Note that I am planning of huge overhaul to the Database code(I plan to add storage drivers too which abstracts torrent storage). I just need to get time to work on this. |
Yes, I agree that tests need to be written for DB. sqlite doesn't need any external tools for testing. Let us use https://github.com/fergusstrange/embedded-postgres for psql tests. |
@evrins , Sorry for rejecting this PR. I appreciate your work. Had you asked me before starting your work, I would have told you then itself 😅 BTW, if you have some time and can work on this project, I can give you pointers on where to work and what to work. You can pick it up and work on it. |
@varbhat next time I will open a issue before making any changes |
These are the things I wish exatorrent has. I would be more than happy if you have time and can work on this. |
@evrins , For libtorrent backend if you are interested, maybe we can use https://github.com/ElementumOrg/libtorrent-go ? Or let's create bindings using SWIG. |
Continuing, these might be priorities as well.
|
Ok I will work on them |
since we are supporting multi type database it will make much more easier to access data with orm.
with orm we won't have to write the same sql multi times
also the bun lib api looks good to me
the bigest changes is the underlaying sqlite lib bun sqlite lib
it will use cgo free modernc.org/sqlite on supported platforms
and mattn/go-sqlite3 if Cgo is enabled
I've tested compatibility between old and new verison of exatorrent, it works fine for both version