Closed n-dusan closed 5 months ago
Thanks for the review. My thought for traits is that they were a convenient way of mapping out all the queries, because then we can mock/test the database queries in our testing framework. Do you think there might be a better way of doing it? I'll test my hypothesis by adding tests hopefully in the near future!
Ah yes, traits make sense for testing. I can't say I've ever actually mocked DB calls, in any language. What are the advantages? I suppose the main one is that it speeds up tests? It seems a bit brittle to me, that the mocked responses could become stale, creating false positives. And that some extra coverage is gained by testing against a real database.
But anyway, using traits to aid tests is a legitimate use case, so all good.
Closes #39
A couple of notable changes:
Database improvements.
statements/inserts.rs
andstatements/queries.rs
tomodels/*/manager.rs
modules. This change shows a gigantic git diff for all those functions, but is mostly just codebase reorganizing.Add
md-5
crate that hashes the composite key columns as the primary key, instead of using composite keys everywhere. This improvement brings the database size down significantly, since we're not storing expensive duplicate column text values for tables.Commits:
refact(db): re-organize models with db Manager and TxManager traits
refact: optimize database
refact(model): use new to initialize sqlx structs
Ergonomics and QoL improvements:
stelae insert-history
intostelae update
.app.rs
androutes.rs
modules, since returning/propagating errors from closures when we return an opaqueApp
type was causing us compiling issues. I tried to explain the reasoning behind the issue in anapp.rs
comment. I think we can fix/resolve this at a later point?