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

Function getRulesContext

cmd/cql-proxy/api/project.go:1292–1316  ·  view source on GitHub ↗
(dbID proto.DatabaseID, db *gorp.DbMap)

Source from the content-addressed store, hash-verified

1290}
1291
1292func getRulesContext(dbID proto.DatabaseID, db *gorp.DbMap) (ctx *projectRulesContext, err error) {
1293 ctx = &projectRulesContext{
1294 dbID: dbID,
1295 db: db,
1296 tables: map[string]*model.ProjectConfig{},
1297 }
1298
1299 var configs []*model.ProjectConfig
1300 configs, err = model.GetAllProjectConfig(db)
1301 if err != nil {
1302 err = errors.Wrapf(err, "get project config failed")
1303 return
1304 }
1305
1306 for _, cfg := range configs {
1307 switch cfg.Type {
1308 case model.ProjectConfigTable:
1309 ctx.tables[cfg.Key] = cfg
1310 case model.ProjectConfigGroup:
1311 ctx.group = cfg
1312 }
1313 }
1314
1315 return
1316}
1317
1318func populateRulesContext(c *gin.Context, ctx *projectRulesContext) (r *resolver.Rules, err error) {
1319 var (

Callers 3

updateProjectGroupConfigFunction · 0.85
updateProjectTableRulesFunction · 0.85
loadRulesFunction · 0.85

Calls 1

GetAllProjectConfigFunction · 0.92

Tested by

no test coverage detected