Files
tasks/common/persistence/sql/sqlplugin/visibility_query_converter.go
Rodrigo ZhouandGitHub 85ce4298ef Add namespace filter in SQL VisibilityStore instead of query converter (#8642)
## What changed?
Move the namespace filter from the inside the unified query converter to
the VisibilityStore code.

## Why?
That's a filter that needs to be added no matter the query converter
implementation.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [x] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
2025-11-18 18:38:06 -06:00

60 lines
1.2 KiB
Go

//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination visibility_query_converter_mock.go
package sqlplugin
import (
"encoding/json"
"time"
"github.com/temporalio/sqlparser"
"go.temporal.io/server/common/persistence/visibility/store/query"
)
type (
VisibilityPageToken struct {
CloseTime time.Time
StartTime time.Time
RunID string
}
)
func DeserializeVisibilityPageToken(data []byte) (*VisibilityPageToken, error) {
if len(data) == 0 {
return nil, nil
}
var token *VisibilityPageToken
err := json.Unmarshal(data, &token)
return token, err
}
func SerializeVisibilityPageToken(token *VisibilityPageToken) ([]byte, error) {
data, err := json.Marshal(token)
return data, err
}
type VisibilityQueryConverter interface {
GetDatetimeFormat() string
ConvertKeywordListComparisonExpr(
operator string,
col *query.SAColumn,
value sqlparser.Expr,
) (sqlparser.Expr, error)
ConvertTextComparisonExpr(
operator string,
col *query.SAColumn,
value sqlparser.Expr,
) (sqlparser.Expr, error)
BuildSelectStmt(
queryExpr *query.QueryParams[sqlparser.Expr],
pageSize int,
pageToken *VisibilityPageToken,
) (string, []any)
BuildCountStmt(
queryExpr *query.QueryParams[sqlparser.Expr],
) (string, []any)
}