moul / depviz

đŸ‘“ dependency visualizer for GitHub & GitLab (a.k.a., "auto-roadmap")
https://manfred.life/depviz
Other
143 stars 12 forks source link

switch db #651

Open Doozers opened 1 year ago

Doozers commented 1 year ago

relate on #649

It isn't a better idea to abstract the db in a first place instead of replacing it ?

advantage:

// database.go
type Database interface {
    GetTasks(...)
    PushTasks(...)
    ...
}

// cayley.go
type cayleyDB {
}

func (c *cayleyDB) GetTasks(...) {
[...]
}

and if needed

// gorm.go
type gormDB {
}

func (c *gormDB) GetTasks(...) {
[...]
}

wdy think about it @moul ?

┆Issue is synchronized with this Trello card

moul commented 1 year ago

If the target is to have multiple databases, the this separation can make the hybrid approach very difficult to implement and maintain, and make transaction (and rollback) harder to manage too.

What about keeping your idea but without the need of an interface and multiple implementations; one implementation that can have one or multiple underlying databases; and clear function names and more isolated logic as you suggested?

Cayley is great but it's hard; I've strong believes that the best target is the hybrid approach; probably sql as the source; and Cayley as a smart cache synchronized when we need its extra features.