(ctx context.Context, project string, rule *config.Rule, crud model.CrudAuthInterface, args, auth map[string]interface{}, returnWhere model.ReturnWhereStub)
| 129 | } |
| 130 | |
| 131 | func (m *Module) matchQuery(ctx context.Context, project string, rule *config.Rule, crud model.CrudAuthInterface, args, auth map[string]interface{}, returnWhere model.ReturnWhereStub) (*model.PostProcess, error) { |
| 132 | // Adjust the find object to load any variables referenced from state |
| 133 | find := utils.Adjust(ctx, rule.Find, args).(map[string]interface{}) |
| 134 | |
| 135 | // Create a new read request |
| 136 | req := &model.ReadRequest{Find: find, Operation: utils.All} |
| 137 | req.Cache = rule.Cache |
| 138 | |
| 139 | // Execute the read request |
| 140 | attr := map[string]string{"project": project, "db": rule.DB, "col": rule.Col} |
| 141 | data, _, err := crud.Read(ctx, rule.DB, rule.Col, req, model.RequestParams{Claims: auth, Resource: "db-read", Op: "access", Attributes: attr}) |
| 142 | if err != nil { |
| 143 | return nil, formatError(ctx, rule, err) |
| 144 | } |
| 145 | |
| 146 | if rule.Store == "" { |
| 147 | rule.Store = "args.result" |
| 148 | } |
| 149 | if err := utils.StoreValue(ctx, rule.Store, data, args); err != nil { |
| 150 | return nil, formatError(ctx, rule, err) |
| 151 | } |
| 152 | |
| 153 | postProcess, err := m.matchRule(ctx, project, rule.Clause, args, auth, returnWhere) |
| 154 | return postProcess, formatError(ctx, rule, err) |
| 155 | } |
| 156 | |
| 157 | func (m *Module) matchAnd(ctx context.Context, projectID string, rule *config.Rule, args, auth map[string]interface{}, returnWhere model.ReturnWhereStub) (*model.PostProcess, error) { |
| 158 | completeAction := &model.PostProcess{} |
no test coverage detected