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

Function getProjectDB

cmd/cql-proxy/api/project.go:1264–1290  ·  view source on GitHub ↗
(c *gin.Context, dbID proto.DatabaseID)

Source from the content-addressed store, hash-verified

1262}
1263
1264func getProjectDB(c *gin.Context, dbID proto.DatabaseID) (project *model.Project, db *gorp.DbMap, err error) {
1265 developer := getDeveloperID(c)
1266
1267 project, err = model.GetProjectByID(model.GetDB(c), dbID, developer)
1268 if err != nil {
1269 err = errors.Wrapf(err, "get project info failed")
1270 return
1271 }
1272
1273 p, err := model.GetAccountByID(model.GetDB(c), developer, project.Account)
1274 if err != nil {
1275 err = errors.Wrapf(err, "get project owner user info failed")
1276 return
1277 }
1278
1279 if err = p.LoadPrivateKey(); err != nil {
1280 err = errors.Wrapf(err, "decode account private key failed")
1281 return
1282 }
1283
1284 db, err = initProjectDB(dbID, p.Key)
1285 if err != nil {
1286 err = errors.Wrapf(err, "init project database failed")
1287 }
1288
1289 return
1290}
1291
1292func getRulesContext(dbID proto.DatabaseID, db *gorp.DbMap) (ctx *projectRulesContext, err error) {
1293 ctx = &projectRulesContext{

Callers 15

projectUserListFunction · 0.85
preRegisterProjectUserFunction · 0.85
queryProjectUserFunction · 0.85
updateProjectUserFunction · 0.85
updateProjectOAuthConfigFunction · 0.85
updateProjectGroupConfigFunction · 0.85
updateProjectMiscConfigFunction · 0.85
getProjectConfigFunction · 0.85
getProjectTablesFunction · 0.85
createProjectTableFunction · 0.85
getProjectTableDetailFunction · 0.85
addFieldsToProjectTableFunction · 0.85

Calls 6

GetProjectByIDFunction · 0.92
GetDBFunction · 0.92
GetAccountByIDFunction · 0.92
getDeveloperIDFunction · 0.85
initProjectDBFunction · 0.85
LoadPrivateKeyMethod · 0.80

Tested by

no test coverage detected