doc: add diary
All checks were successful
Build and test / Build (push) Successful in 2m21s

This commit is contained in:
Muyao CHEN 2024-10-15 21:08:06 +02:00
parent 20ef75b1aa
commit 322b441c70

View File

@ -358,3 +358,21 @@ token, so that it is removed automatically.
It'd better to inject the dependency of Redis connection into the `Authn` It'd better to inject the dependency of Redis connection into the `Authn`
middleware so that it's simpler to test. middleware so that it's simpler to test.
### 2024/10/15
Redis is integrated to keep a blacklist of logged out users. BTW `memcached`
is also interesting. In case later I want to switch to another key-value
storage, I have made an interface. It also helps for the test. I can even
just drop the redis and use a bare-hand native hashmap.
Quite a lot benefits. And then I realised that I have done "wrong" about
`sqlc`. I shouldn't have used the pgx driver, instead the `database/sql`
driver is more universal, if I want to switch to sqlite or mysql later.
Well it's not about changing the technical solution every 3 days, but a
system than can survive those changes elegantly must be a robust system, with
functionalities well decoupled and interfaces well defined.
I will add some tests for existing code and then it's time to move on to
my core business logic.