( ctx context.Context, stores *store.Store, licenseService *enterprise.LicenseService, limit int32, projectID string, )
| 468 | } |
| 469 | |
| 470 | func getEffectiveQueryDataPolicy( |
| 471 | ctx context.Context, |
| 472 | stores *store.Store, |
| 473 | licenseService *enterprise.LicenseService, |
| 474 | limit int32, |
| 475 | projectID string, |
| 476 | ) *store.EffectiveQueryDataPolicy { |
| 477 | value := &store.EffectiveQueryDataPolicy{ |
| 478 | MaximumResultSize: common.DefaultMaximumSQLResultSize, |
| 479 | MaximumResultRows: math.MaxInt32, |
| 480 | } |
| 481 | if err := licenseService.IsFeatureEnabled(ctx, common.GetWorkspaceIDFromContext(ctx), v1pb.PlanFeature_FEATURE_QUERY_POLICY); err == nil { |
| 482 | policy, err := stores.GetEffectiveQueryDataPolicy(ctx, common.GetWorkspaceIDFromContext(ctx), common.FormatProject(projectID)) |
| 483 | if err != nil { |
| 484 | slog.Error("failed to get the query data policy", log.BBError(err)) |
| 485 | return value |
| 486 | } |
| 487 | value = policy |
| 488 | } |
| 489 | if limit > 0 { |
| 490 | value.MaximumResultRows = min(limit, value.MaximumResultRows) |
| 491 | } |
| 492 | if value.MaximumResultRows == math.MaxInt32 { |
| 493 | value.MaximumResultRows = 0 |
| 494 | } |
| 495 | return value |
| 496 | } |
| 497 | |
| 498 | type accessCheckFunc func(context.Context, *store.InstanceMessage, *store.DatabaseMessage, *store.UserMessage, []*parserbase.QuerySpan, bool /* isExplain */, []parserbase.Statement, string /* requestSchema */, bool /* multiStatement */) error |
| 499 |
no test coverage detected