trustbloc / edge-core

Shared libraries
Apache License 2.0
2 stars 13 forks source link

storage: common API that selects appropriate provider given a DSN #44

Open llorllale opened 4 years ago

llorllale commented 4 years ago

It would be nice to have an API that looks like this:

// mysql provider automatically selected 
provider, err := storage.Open("mysql://root:my-secret-pw@tcp(127.0.0.1:3306)/")
if err != nil {
    // handle error
}

This would reduce refactors users would have to do when selecting different storage providers.

Current obstacles:

llorllale commented 4 years ago

Take a look at what edge-adapter did:

https://github.com/trustbloc/edge-adapter/blob/c8d09fbaf198a8149535ca1ebe6cd766f4864e64/cmd/adapter-rest/startcmd/start.go#L162-L170

https://github.com/trustbloc/edge-adapter/blob/c8d09fbaf198a8149535ca1ebe6cd766f4864e64/cmd/adapter-rest/startcmd/start.go#L625-L666