You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should encapsulate external Databases in an Interface (interface DB) with embedded Methods like:
sign in
connect
other CRUD's
this seperates the user (eg. handler) from the product specific implementations.
With that we can select which db-product (eg. surreal, postgres, cassandra) we use to instantiate the db.
This can be selected by an optional config flag (shouldn't be included in preset).
This enables us to slowly migrate from one db to another (if needed) without:
touching a hundred different functions
having to wait on a migration branch to finish before adding new stuff that depends on db
db/surreal.go, db/postgres.go and db/cassandra.go now only have to implement all methods of Database to for example satisfy a handler that requests a Database from FX:
funcGetAllAgentsHandler(db*db.Database){
// logic here
}
The text was updated successfully, but these errors were encountered:
If this gets implemented successfully and proves a viable option at this state we can do the same for viper (config management), the tracer (currently OpenTelemetry, but we could use the go built in one for smaller runtime impact during development)
We should encapsulate external Databases in an Interface (
interface DB
) with embedded Methods like:this seperates the user (eg. handler) from the product specific implementations.
With that we can select which db-product (eg. surreal, postgres, cassandra) we use to instantiate the db.
This can be selected by an optional config flag (shouldn't be included in preset).
This enables us to slowly migrate from one db to another (if needed) without:
example(s):
db/db.go:
db/surreal.go
,db/postgres.go
anddb/cassandra.go
now only have to implement all methods ofDatabase
to for example satisfy a handler that requests a Database from FX:The text was updated successfully, but these errors were encountered: