iskendria-pub / iskendria

Blockchain-based system for scientific publishing
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Choose database solution for the client side #21

Open mhdirkse opened 5 years ago

mhdirkse commented 5 years ago

[AX-21] created by mdi

mhdirkse commented 5 years ago

by dirkse

mhdirkse commented 5 years ago

by dirkse

mhdirkse commented 5 years ago

by dirkse

mhdirkse commented 5 years ago

Client-side data can best be stored in a relational database. This make searching the data easier. But the right tool has to be chosen.

mhdirkse commented 5 years ago

I have a working example in Golang with SQLite. There is a standard database interface "database/sql" that multiple drivers implement. I chose this driver: https://github.com/mattn/go-sqlite3.

mhdirkse commented 5 years ago

I wondered whether to use an ORM framework, like you have Hibernate for Java. I found this discussion:

https://www.reddit.com/r/golang/comments/3ajqa6/golang_which_orm_is_better/

Mr. or Mrs. hobbified found no framework that satisfied him or her. I tend to believe him, because I also found for web development that web framework are no improvement to pure Golang.

Hobbified, and other users, recommend https://github.com/jmoiron/sqlx, which provides some extras to database/sql. It allows more compact syntax to fetch multi-row results and read and write structs. Boilerplate code still is not eliminated.

I think the following is best for Alexandria. I can write a separate module, or Data Access Objects (DAOs) to access a local database. I can generate DAO code to be more efficient.

mhdirkse commented 5 years ago

Here is a manual about database/sql:

http://go-database-sql.org/references.html