Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch db #651

Open
Doozers opened this issue Mar 24, 2023 · 1 comment
Open

switch db #651

Doozers opened this issue Mar 24, 2023 · 1 comment

Comments

@Doozers
Copy link
Collaborator

Doozers commented Mar 24, 2023

relate on #649

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

advantage:

  • It will decrease the complexity of use.
  • smaller access will act like documentation
  • It will keep the optimized and fast advantage of the cayleygraphDB
  • If after abstracting, it still to hard to use, it will be easy to implement the db with a gorm/sqlite for example
// 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
Copy link
Owner

moul commented Mar 24, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants