Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: impl search sheet filter source (#7828)

p0nye7d78403bd5c
diff --git a/backend/api/v1/sheet_service.go b/backend/api/v1/sheet_service.go
index 9d62a0bb1c..e057c0386b 100644
--- a/backend/api/v1/sheet_service.go
+++ b/backend/api/v1/sheet_service.go
@@ -253,6 +253,16 @@ func (s *SheetService) SearchSheets(ctx context.Context, request *v1pb.SearchShe
default:
return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid value %q for starred", spec.value))
}
+ case "source":
+ switch spec.operator {
+ case comparatorTypeEqual:
+ source := store.SheetSource(spec.value)
+ sheetFind.Source = &source
+ case comparatorTypeNotEqual:
+ source := store.SheetSource(spec.value)
+ sheetFind.NotSource = &source
+ }
+
default:
return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid filter key %q", spec.key))
}
diff --git a/backend/store/sheet.go b/backend/store/sheet.go
index 9e0a7fbc8d..8927a1a519 100644
--- a/backend/store/sheet.go
+++ b/backend/store/sheet.go
@@ -105,6 +105,7 @@ type FindSheetMessage struct {
Name *string
Visibilities []SheetVisibility
Source *SheetSource
+ NotSource *SheetSource
Type *SheetType
PayloadType *string
// Used to find (un)starred/pinned sheet list, could be PRIVATE/PROJECT/PUBLIC sheet.
@@ -215,6 +216,9 @@ func (s *Store) ListSheets(ctx context.Context, find *FindSheetMessage, currentP
if v := find.Source; v != nil {
where, args = append(where, fmt.Sprintf("sheet.source = $%d", len(args)+1)), append(args, *v)
}
+ if v := find.NotSource; v != nil {
+ where, args = append(where, fmt.Sprintf("sheet.source != $%d", len(args)+1)), append(args, *v)
+ }
if v := find.Type; v != nil {
where, args = append(where, fmt.Sprintf("sheet.type = $%d", len(args)+1)), append(args, *v)
}