MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / getCurrentProjectDB

Function getCurrentProjectDB

cmd/cql-proxy/api/user_oauth.go:380–400  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

378}
379
380func getCurrentProjectDB(c *gin.Context) (db *gorp.DbMap, err error) {
381 project := getCurrentProject(c)
382
383 p, err := model.GetAccountByID(model.GetDB(c), project.Developer, project.Account)
384 if err != nil {
385 err = errors.Wrapf(err, "get project owner user info failed")
386 return
387 }
388
389 if err = p.LoadPrivateKey(); err != nil {
390 err = errors.Wrapf(err, "decode account private key failed")
391 return
392 }
393
394 db, err = initProjectDB(project.DB, p.Key)
395 if err != nil {
396 err = errors.Wrapf(err, "init project database failed")
397 }
398
399 return
400}
401
402func userSessionInject(c *gin.Context) {
403 projectDB, err := getCurrentProjectDB(c)

Callers 5

userOAuthAuthorizeFunction · 0.85
handleUserOAuthCallbackFunction · 0.85
getUserInfoFunction · 0.85
userSessionInjectFunction · 0.85
buildExecuteContextFunction · 0.85

Calls 5

GetAccountByIDFunction · 0.92
GetDBFunction · 0.92
getCurrentProjectFunction · 0.85
initProjectDBFunction · 0.85
LoadPrivateKeyMethod · 0.80

Tested by

no test coverage detected