Documentation ¶
Overview ¶
Package searchattribute is a generated GoMock package.
Index ¶
- Constants
- Variables
- func ApplyTypeMap(searchAttributes *commonpb.SearchAttributes, typeMap NameTypeMap)
- func BuildIndexNameTypeMap(indexSearchAttributes map[string]*persistencespb.IndexSearchAttributes) map[string]NameTypeMap
- func BuildTypeMap(validSearchAttributesFn dynamicconfig.MapPropertyFn) (map[string]enumspb.IndexedValueType, error)
- func Decode(searchAttributes *commonpb.SearchAttributes, typeMap *NameTypeMap) (map[string]interface{}, error)
- func DecodeValue(value *commonpb.Payload, t enumspb.IndexedValueType) (interface{}, error)
- func Encode(searchAttributes map[string]interface{}, typeMap *NameTypeMap) (*commonpb.SearchAttributes, error)
- func EncodeValue(val interface{}, t enumspb.IndexedValueType) (*commonpb.Payload, error)
- func FilterCustomOnly(searchAttributes map[string]enumspb.IndexedValueType) map[string]enumspb.IndexedValueType
- func IsReservedField(fieldName string) bool
- func MapESType(t enumspb.IndexedValueType) string
- func NoAttrPrefix(saName string) bool
- func Parse(searchAttributesStr map[string]string, typeMap *NameTypeMap) (*commonpb.SearchAttributes, error)
- func Stringify(searchAttributes *commonpb.SearchAttributes, typeMap *NameTypeMap) (map[string]string, error)
- type Manager
- type MockManager
- type MockManagerMockRecorder
- 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 TestProvider
- type Validator
- func (v *Validator) Validate(searchAttributes *commonpb.SearchAttributes, namespace string, ...) error
- func (v *Validator) ValidateAndLog(searchAttributes *commonpb.SearchAttributes, namespace string, ...) error
- func (v *Validator) ValidateSize(searchAttributes *commonpb.SearchAttributes, namespace string) error
Constants ¶
const ( // Indexed fields on ES. NamespaceID = "NamespaceId" WorkflowID = "WorkflowId" RunID = "RunId" WorkflowType = "WorkflowType" StartTime = "StartTime" ExecutionTime = "ExecutionTime" CloseTime = "CloseTime" ExecutionStatus = "ExecutionStatus" TaskQueue = "TaskQueue" // Valid non-indexed fields on ES. HistoryLength = "HistoryLength" Encoding = "Encoding" Memo = "Memo" VisibilityTaskKey = "VisibilityTaskKey" // Attr is prefix for search attributes. Attr = "Attr" // System search attributes. TemporalChangeVersion = "TemporalChangeVersion" BinaryChecksums = "BinaryChecksums" CustomNamespace = "CustomNamespace" Operator = "Operator" )
const (
MetadataType = "type"
)
Variables ¶
var ( ErrInvalidName = errors.New("invalid search attribute name") ErrInvalidType = errors.New("invalid search attribute type") )
var (
ErrExceedSizeLimit = errors.New("exceeds size limit")
)
var ( TestNameTypeMap = NameTypeMap{ // contains filtered or unexported fields } )
Functions ¶
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 BuildIndexNameTypeMap ¶ added in v1.10.0
func BuildIndexNameTypeMap(indexSearchAttributes map[string]*persistencespb.IndexSearchAttributes) map[string]NameTypeMap
func BuildTypeMap ¶
func BuildTypeMap(validSearchAttributesFn dynamicconfig.MapPropertyFn) (map[string]enumspb.IndexedValueType, error)
BuildTypeMap converts search attributes types from dynamic config map to type map. TODO: Remove after 1.10.0 release
func Decode ¶
func Decode(searchAttributes *commonpb.SearchAttributes, typeMap *NameTypeMap) (map[string]interface{}, error)
Decode decodes search attributes to the map of search attribute values 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.
func DecodeValue ¶
func DecodeValue(value *commonpb.Payload, t enumspb.IndexedValueType) (interface{}, error)
DecodeValue decodes search attribute value from Payload using (in order): 1. type from MetadataType field, 2. passed type t.
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 (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 FilterCustomOnly ¶ added in v1.10.0
func FilterCustomOnly(searchAttributes map[string]enumspb.IndexedValueType) map[string]enumspb.IndexedValueType
FilterCustomOnly returns new search attributes map with only custom search attributes in it. TODO: Remove this after 1.10.0 release
func IsReservedField ¶ added in v1.9.0
IsReservedField return true if field name is system reserved.
func MapESType ¶ added in v1.10.0
func MapESType(t enumspb.IndexedValueType) string
func NoAttrPrefix ¶ added in v1.10.0
NoAttrPrefix return true if search attribute is system and doesn't require Attr prefix. TODO: remove with Attr prefix removal
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 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.
Types ¶
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(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(indexName, newCustomSearchAttributes interface{}) *gomock.Call
SaveSearchAttributes indicates an expected call of SaveSearchAttributes.
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 (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 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( logger log.Logger, searchAttributesProvider Provider, searchAttributesNumberOfKeysLimit dynamicconfig.IntPropertyFnWithNamespaceFilter, searchAttributesSizeOfValueLimit dynamicconfig.IntPropertyFnWithNamespaceFilter, searchAttributesTotalSizeLimit dynamicconfig.IntPropertyFnWithNamespaceFilter, ) *Validator
NewValidator create Validator
func (*Validator) Validate ¶
func (v *Validator) Validate(searchAttributes *commonpb.SearchAttributes, namespace string, indexName string) error
Validate validate search attributes are valid for writing.
func (*Validator) ValidateAndLog ¶
func (v *Validator) ValidateAndLog(searchAttributes *commonpb.SearchAttributes, namespace string, indexName string) error
ValidateAndLog validate search attributes are valid for writing and not exceed limits
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