Documentation ¶
Overview ¶
Package searchattribute is a generated GoMock package.
Package searchattribute is a generated GoMock package.
Index ¶
- Constants
- Variables
- func AddSearchAttribute(saPtr **commonpb.SearchAttributes, key string, value *commonpb.Payload)
- func AliasFields(mapperProvider MapperProvider, searchAttributes *commonpb.SearchAttributes, ...) (*commonpb.SearchAttributes, error)
- func ApplyTypeMap(searchAttributes *commonpb.SearchAttributes, typeMap NameTypeMap)
- func Decode(searchAttributes *commonpb.SearchAttributes, typeMap *NameTypeMap, ...) (map[string]interface{}, error)
- func DecodeValue(value *commonpb.Payload, t enumspb.IndexedValueType, allowList bool) (any, error)
- func Encode(searchAttributes map[string]interface{}, typeMap *NameTypeMap) (*commonpb.SearchAttributes, error)
- func EncodeValue(val interface{}, t enumspb.IndexedValueType) (*commonpb.Payload, error)
- func GetSqlDbColName(name string) string
- func GetSqlDbIndexSearchAttributes() *persistencespb.IndexSearchAttributes
- func IsMappable(name string) bool
- func IsReserved(name string) bool
- func IsSystem(name string) bool
- func NewManager(timeSource clock.TimeSource, ...) *managerImpl
- func Parse(searchAttributesStr map[string]string, typeMap *NameTypeMap) (*commonpb.SearchAttributes, error)
- func QueryWithAnyNamespaceDivision(query string) string
- func Stringify(searchAttributes *commonpb.SearchAttributes, typeMap *NameTypeMap) (map[string]string, error)
- func UnaliasFields(mapperProvider MapperProvider, searchAttributes *commonpb.SearchAttributes, ...) (*commonpb.SearchAttributes, error)
- type Manager
- type Mapper
- type MapperProvider
- type MockManager
- type MockManagerMockRecorder
- type MockMapper
- type MockMapperMockRecorder
- type MockMapperProvider
- type MockMapperProviderMockRecorder
- type MockProvider
- type MockProviderMockRecorder
- type NameTypeMap
- func (m NameTypeMap) All() map[string]enumspb.IndexedValueType
- func (m NameTypeMap) Custom() map[string]enumspb.IndexedValueType
- func (m NameTypeMap) GetType(name string) (enumspb.IndexedValueType, error)
- func (m NameTypeMap) IsDefined(name string) bool
- func (m NameTypeMap) System() map[string]enumspb.IndexedValueType
- type Provider
- type SystemProvider
- type TestMapper
- type TestProvider
- type Validator
Constants ¶
const ( NamespaceID = "NamespaceId" WorkflowID = "WorkflowId" RunID = "RunId" WorkflowType = "WorkflowType" StartTime = "StartTime" ExecutionTime = "ExecutionTime" CloseTime = "CloseTime" ExecutionStatus = "ExecutionStatus" TaskQueue = "TaskQueue" HistoryLength = "HistoryLength" ExecutionDuration = "ExecutionDuration" StateTransitionCount = "StateTransitionCount" TemporalChangeVersion = "TemporalChangeVersion" BinaryChecksums = "BinaryChecksums" BuildIds = "BuildIds" BatcherNamespace = "BatcherNamespace" BatcherUser = "BatcherUser" HistorySizeBytes = "HistorySizeBytes" ParentWorkflowID = "ParentWorkflowId" ParentRunID = "ParentRunId" TemporalNamespaceDivision = "TemporalNamespaceDivision" // These fields are not in Elasticsearch mappings definition and therefore are not indexed. MemoEncoding = "MemoEncoding" Memo = "Memo" VisibilityTaskKey = "VisibilityTaskKey" // Added to workflows started by a schedule. TemporalScheduledStartTime = "TemporalScheduledStartTime" TemporalScheduledById = "TemporalScheduledById" // Used by scheduler workflow. TemporalSchedulePaused = "TemporalSchedulePaused" ReservedPrefix = "Temporal" )
const (
MetadataType = "type"
)
Variables ¶
var ( ErrInvalidName = errors.New("invalid search attribute name") ErrInvalidType = errors.New("invalid search attribute type") )
var ( TestNameTypeMap = NameTypeMap{ // contains filtered or unexported fields } TestAliases = map[string]string{ "Int01": "CustomIntField", "Text01": "CustomTextField", "Keyword01": "CustomKeywordField", "Datetime01": "CustomDatetimeField", "Double01": "CustomDoubleField", "Bool01": "CustomBoolField", "KeywordList01": "CustomKeywordListField", } )
var ErrInvalidString = errors.New("SearchAttribute value is not a valid UTF-8 string")
Functions ¶
func AddSearchAttribute ¶ added in v1.17.3
func AddSearchAttribute(saPtr **commonpb.SearchAttributes, key string, value *commonpb.Payload)
This may mutate saPtr and *saPtr
func AliasFields ¶ added in v1.18.0
func AliasFields( mapperProvider MapperProvider, searchAttributes *commonpb.SearchAttributes, namespaceName string, ) (*commonpb.SearchAttributes, error)
AliasFields returns SearchAttributes struct where each search attribute name is replaced with alias. If no replacement where made, it returns nil which means that original SearchAttributes struct should be used.
func ApplyTypeMap ¶
func ApplyTypeMap(searchAttributes *commonpb.SearchAttributes, typeMap NameTypeMap)
ApplyTypeMap set type for all valid search attributes which don't have it. It doesn't do any validation and just skip invalid or already set search attributes.
func Decode ¶
func Decode( searchAttributes *commonpb.SearchAttributes, typeMap *NameTypeMap, allowList bool, ) (map[string]interface{}, error)
Decode decodes search attributes to the map of search attribute values using (in order): 1. type from typeMap, 2. if typeMap is nil, type from MetadataType field is used. In case of error, it will continue to next search attribute and return last error.
func DecodeValue ¶
func DecodeValue( value *commonpb.Payload, t enumspb.IndexedValueType, allowList bool, ) (any, error)
DecodeValue decodes search attribute value from Payload using (in order): 1. passed type t. 2. type from MetadataType field, if t is not specified. allowList allows list of values when it's not keyword list type.
func Encode ¶
func Encode(searchAttributes map[string]interface{}, typeMap *NameTypeMap) (*commonpb.SearchAttributes, error)
Encode encodes map of search attribute values to search attributes. typeMap can be nil (then MetadataType field won't be set). In case of error, it will continue to next search attribute and return last error.
func EncodeValue ¶
func EncodeValue(val interface{}, t enumspb.IndexedValueType) (*commonpb.Payload, error)
EncodeValue encodes search attribute value and IndexedValueType to Payload.
func GetSqlDbColName ¶ added in v1.20.0
GetSqlDbColName maps system and reserved search attributes to column names for SQL tables. If the input is not a system or reserved search attribute, then it returns the input.
func GetSqlDbIndexSearchAttributes ¶ added in v1.20.0
func GetSqlDbIndexSearchAttributes() *persistencespb.IndexSearchAttributes
func IsMappable ¶ added in v1.12.1
IsMappable returns true if name can have be mapped tho the alias.
func IsReserved ¶ added in v1.11.0
IsReserved returns true if name is system reserved and can't be used as custom search attribute name.
func NewManager ¶ added in v1.13.0
func NewManager( timeSource clock.TimeSource, clusterMetadataManager persistence.ClusterMetadataManager, forceRefresh dynamicconfig.BoolPropertyFn, ) *managerImpl
func Parse ¶
func Parse(searchAttributesStr map[string]string, typeMap *NameTypeMap) (*commonpb.SearchAttributes, error)
Parse converts maps of search attribute strings to search attributes. typeMap can be nil (values will be parsed with strconv and MetadataType field won't be set). In case of error, it will continue to next search attribute and return last error. Single values are parsed using strconv, arrays are parsed using json.Unmarshal.
func QueryWithAnyNamespaceDivision ¶ added in v1.23.0
QueryWithAnyNamespaceDivision returns a modified workflow visibility query that disables special handling of namespace division and so matches workflows in all namespace divisions. Normally a query that didn't explicitly mention TemporalNamespaceDivision would be limited to the default (empty string) namespace division.
func Stringify ¶
func Stringify(searchAttributes *commonpb.SearchAttributes, typeMap *NameTypeMap) (map[string]string, error)
Stringify converts search attributes to map of strings using (in order): 1. type from MetadataType field, 2. type from typeMap (can be nil). In case of error, it will continue to next search attribute and return last error. Single values are converted using strconv, arrays are converted using json.Marshal. Search attributes with `nil` values are skipped.
func UnaliasFields ¶ added in v1.18.0
func UnaliasFields( mapperProvider MapperProvider, searchAttributes *commonpb.SearchAttributes, namespaceName string, ) (*commonpb.SearchAttributes, error)
UnaliasFields returns SearchAttributes struct where each search attribute alias is replaced with field name.
Types ¶
type Mapper ¶ added in v1.12.1
type Mapper interface { GetAlias(fieldName string, namespace string) (string, error) GetFieldName(alias string, namespace string) (string, error) }
Mapper interface allows overriding custom search attribute names with aliases per namespace. Create an instance of a Mapper interface and pass it to the temporal.NewServer using temporal.WithSearchAttributesMapper. Returned error must be from the serviceerror package.
type MapperProvider ¶ added in v1.20.0
func NewMapperProvider ¶ added in v1.20.0
func NewTestMapperProvider ¶ added in v1.20.0
func NewTestMapperProvider(customMapper Mapper) MapperProvider
type MockManager ¶ added in v1.10.0
type MockManager struct {
// contains filtered or unexported fields
}
MockManager is a mock of Manager interface.
func NewMockManager ¶ added in v1.10.0
func NewMockManager(ctrl *gomock.Controller) *MockManager
NewMockManager creates a new mock instance.
func (*MockManager) EXPECT ¶ added in v1.10.0
func (m *MockManager) EXPECT() *MockManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockManager) GetSearchAttributes ¶ added in v1.10.0
func (m *MockManager) GetSearchAttributes(indexName string, forceRefreshCache bool) (NameTypeMap, error)
GetSearchAttributes mocks base method.
func (*MockManager) SaveSearchAttributes ¶ added in v1.10.0
func (m *MockManager) SaveSearchAttributes(ctx context.Context, indexName string, newCustomSearchAttributes map[string]v1.IndexedValueType) error
SaveSearchAttributes mocks base method.
type MockManagerMockRecorder ¶ added in v1.10.0
type MockManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockManagerMockRecorder is the mock recorder for MockManager.
func (*MockManagerMockRecorder) GetSearchAttributes ¶ added in v1.10.0
func (mr *MockManagerMockRecorder) GetSearchAttributes(indexName, forceRefreshCache interface{}) *gomock.Call
GetSearchAttributes indicates an expected call of GetSearchAttributes.
func (*MockManagerMockRecorder) SaveSearchAttributes ¶ added in v1.10.0
func (mr *MockManagerMockRecorder) SaveSearchAttributes(ctx, indexName, newCustomSearchAttributes interface{}) *gomock.Call
SaveSearchAttributes indicates an expected call of SaveSearchAttributes.
type MockMapper ¶ added in v1.12.1
type MockMapper struct {
// contains filtered or unexported fields
}
MockMapper is a mock of Mapper interface.
func NewMockMapper ¶ added in v1.12.1
func NewMockMapper(ctrl *gomock.Controller) *MockMapper
NewMockMapper creates a new mock instance.
func (*MockMapper) EXPECT ¶ added in v1.12.1
func (m *MockMapper) EXPECT() *MockMapperMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockMapper) GetAlias ¶ added in v1.12.1
func (m *MockMapper) GetAlias(fieldName, namespace string) (string, error)
GetAlias mocks base method.
func (*MockMapper) GetFieldName ¶ added in v1.12.1
func (m *MockMapper) GetFieldName(alias, namespace string) (string, error)
GetFieldName mocks base method.
type MockMapperMockRecorder ¶ added in v1.12.1
type MockMapperMockRecorder struct {
// contains filtered or unexported fields
}
MockMapperMockRecorder is the mock recorder for MockMapper.
func (*MockMapperMockRecorder) GetAlias ¶ added in v1.12.1
func (mr *MockMapperMockRecorder) GetAlias(fieldName, namespace interface{}) *gomock.Call
GetAlias indicates an expected call of GetAlias.
func (*MockMapperMockRecorder) GetFieldName ¶ added in v1.12.1
func (mr *MockMapperMockRecorder) GetFieldName(alias, namespace interface{}) *gomock.Call
GetFieldName indicates an expected call of GetFieldName.
type MockMapperProvider ¶ added in v1.20.0
type MockMapperProvider struct {
// contains filtered or unexported fields
}
MockMapperProvider is a mock of MapperProvider interface.
func NewMockMapperProvider ¶ added in v1.20.0
func NewMockMapperProvider(ctrl *gomock.Controller) *MockMapperProvider
NewMockMapperProvider creates a new mock instance.
func (*MockMapperProvider) EXPECT ¶ added in v1.20.0
func (m *MockMapperProvider) EXPECT() *MockMapperProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockMapperProviderMockRecorder ¶ added in v1.20.0
type MockMapperProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockMapperProviderMockRecorder is the mock recorder for MockMapperProvider.
func (*MockMapperProviderMockRecorder) GetMapper ¶ added in v1.20.0
func (mr *MockMapperProviderMockRecorder) GetMapper(nsName interface{}) *gomock.Call
GetMapper indicates an expected call of GetMapper.
type MockProvider ¶ added in v1.10.0
type MockProvider struct {
// contains filtered or unexported fields
}
MockProvider is a mock of Provider interface.
func NewMockProvider ¶ added in v1.10.0
func NewMockProvider(ctrl *gomock.Controller) *MockProvider
NewMockProvider creates a new mock instance.
func (*MockProvider) EXPECT ¶ added in v1.10.0
func (m *MockProvider) EXPECT() *MockProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockProvider) GetSearchAttributes ¶ added in v1.10.0
func (m *MockProvider) GetSearchAttributes(indexName string, forceRefreshCache bool) (NameTypeMap, error)
GetSearchAttributes mocks base method.
type MockProviderMockRecorder ¶ added in v1.10.0
type MockProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockProviderMockRecorder is the mock recorder for MockProvider.
func (*MockProviderMockRecorder) GetSearchAttributes ¶ added in v1.10.0
func (mr *MockProviderMockRecorder) GetSearchAttributes(indexName, forceRefreshCache interface{}) *gomock.Call
GetSearchAttributes indicates an expected call of GetSearchAttributes.
type NameTypeMap ¶ added in v1.10.0
type NameTypeMap struct {
// contains filtered or unexported fields
}
func NewNameTypeMapStub ¶ added in v1.24.0
func NewNameTypeMapStub(attributes map[string]enumspb.IndexedValueType) NameTypeMap
func (NameTypeMap) All ¶ added in v1.10.0
func (m NameTypeMap) All() map[string]enumspb.IndexedValueType
func (NameTypeMap) Custom ¶ added in v1.10.0
func (m NameTypeMap) Custom() map[string]enumspb.IndexedValueType
func (NameTypeMap) GetType ¶ added in v1.10.0
func (m NameTypeMap) GetType(name string) (enumspb.IndexedValueType, error)
GetType returns type of search attribute from type map.
func (NameTypeMap) IsDefined ¶ added in v1.10.0
func (m NameTypeMap) IsDefined(name string) bool
func (NameTypeMap) System ¶ added in v1.10.0
func (m NameTypeMap) System() map[string]enumspb.IndexedValueType
type Provider ¶ added in v1.10.0
type Provider interface {
GetSearchAttributes(indexName string, forceRefreshCache bool) (NameTypeMap, error)
}
type SystemProvider ¶ added in v1.10.0
type SystemProvider struct{}
func NewSystemProvider ¶ added in v1.10.0
func NewSystemProvider() *SystemProvider
func (*SystemProvider) GetSearchAttributes ¶ added in v1.10.0
func (s *SystemProvider) GetSearchAttributes(_ string, _ bool) (NameTypeMap, error)
type TestMapper ¶ added in v1.20.0
type TestMapper struct {
Namespace string
}
func (*TestMapper) GetAlias ¶ added in v1.20.0
func (t *TestMapper) GetAlias(fieldName string, namespace string) (string, error)
func (*TestMapper) GetFieldName ¶ added in v1.20.0
func (t *TestMapper) GetFieldName(alias string, namespace string) (string, error)
type TestProvider ¶ added in v1.10.0
type TestProvider struct{}
func NewTestProvider ¶ added in v1.10.0
func NewTestProvider() *TestProvider
func (*TestProvider) GetSearchAttributes ¶ added in v1.10.0
func (s *TestProvider) GetSearchAttributes(_ string, _ bool) (NameTypeMap, error)
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator is used to validate search attributes
func NewValidator ¶
func NewValidator( searchAttributesProvider Provider, searchAttributesMapperProvider MapperProvider, searchAttributesNumberOfKeysLimit dynamicconfig.IntPropertyFnWithNamespaceFilter, searchAttributesSizeOfValueLimit dynamicconfig.IntPropertyFnWithNamespaceFilter, searchAttributesTotalSizeLimit dynamicconfig.IntPropertyFnWithNamespaceFilter, visibilityManager manager.VisibilityManager, allowList dynamicconfig.BoolPropertyFnWithNamespaceFilter, suppressErrorSetSystemSearchAttribute dynamicconfig.BoolPropertyFnWithNamespaceFilter, ) *Validator
NewValidator create Validator
func (*Validator) Validate ¶
func (v *Validator) Validate(searchAttributes *commonpb.SearchAttributes, namespace string) error
Validate search attributes are valid for writing. The search attributes must be unaliased before calling validation.
func (*Validator) ValidateSize ¶ added in v1.9.0
func (v *Validator) ValidateSize(searchAttributes *commonpb.SearchAttributes, namespace string) error
ValidateSize validate search attributes are valid for writing and not exceed limits. The search attributes must be unaliased before calling validation.