The Go SDK Client offers APIs for searching for and listing Workflows.
You can provide key-value pairs as SearchAttributes in StartWorkflowOptions.
In Go, SearchAttributes are represented as
The value provided in the map must be the same type that is registered in the dynamic config.
Here are the search attribute value types and their corresponding types in Go:
- Keyword = string
- Int = int64
- Double = float64
- Bool = bool
- Datetime = time.Time
- String = string
UpsertSearchAttributes is used to add or update search attributes from within Workflow code.
Go samples for search attributes can be found at github.com/temporalio/samples-go.
UpsertSearchAttributes will merge attributes to the existing map in the Workflow.
Consider this example Workflow code:
After the second call to
UpsertSearchAttributes, the map will contain:
There is no support for removing a field.
But, to achieve a similar effect, set the field to some placeholder value.
For example, you could set
CustomKeywordField != 'impossibleVal' will match Workflows with
CustomKeywordField not equal to
impossibleVal, which includes Workflows without the
workflow.GetInfo to get current search attributes.