go.temporal.io/server/chasm/visibility_value.go
181 LOC · 110 covered · 71 uncovered · 39 ranges · 216 concepts · 27 introducers · 143 tests
File neighbourhood
The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.
Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.
package chasm
import (
"fmt"
"slices"
"time"
commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
"go.temporal.io/server/common/searchattribute/sadefs"
)
type VisibilityValue interface {
MustEncode() *commonpb.Payload
Equal(VisibilityValue) bool
Value() any
}
type VisibilityValueInt64 int64
return sadefs.MustEncodeValue(int64(v), enumspb.INDEXED_VALUE_TYPE_INT)
}
ov, ok := other.(VisibilityValueInt64)
if !ok {
}
}
return int64(v)
}
type VisibilityValueKeyword string
return sadefs.MustEncodeValue(string(v), enumspb.INDEXED_VALUE_TYPE_KEYWORD)
}
ov, ok := other.(VisibilityValueKeyword)
if !ok {
}
}
return string(v)
}
type VisibilityValueBool bool
return sadefs.MustEncodeValue(bool(v), enumspb.INDEXED_VALUE_TYPE_BOOL)
}
ov, ok := other.(VisibilityValueBool)
if !ok {
}
}
return bool(v)
}
type VisibilityValueFloat64 float64
return sadefs.MustEncodeValue(float64(v), enumspb.INDEXED_VALUE_TYPE_DOUBLE)
}
ov, ok := other.(VisibilityValueFloat64)
if !ok {
return false
}
}
return float64(v)
}
type VisibilityValueTime time.Time
return sadefs.MustEncodeValue(time.Time(v), enumspb.INDEXED_VALUE_TYPE_DATETIME)
}
ov, ok := other.(VisibilityValueTime)
if !ok {
}
}
return time.Time(v)
}
type VisibilityValueStringSlice []string
return sadefs.MustEncodeValue([]string(v), enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST)
}
func (v VisibilityValueStringSlice) Equal(other VisibilityValue) bool {
visibility_value.go ×2
ov, ok := other.(VisibilityValueStringSlice)
if !ok {
return false
}
return slices.Equal(v, ov)
}
return []string(v)
}
if v1 == nil && v2 == nil {
}
}
}
type VisibilityValueText string
return sadefs.MustEncodeValue(string(v), enumspb.INDEXED_VALUE_TYPE_TEXT)
}
ov, ok := other.(VisibilityValueText)
if !ok {
return false
}
return v == ov
}
return string(v)
}
// visibilityValueFromPayload decoded payload based on type set in its metadata.
func visibilityValueFromPayload(payload *commonpb.Payload) (VisibilityValue, error) {
search_attribute.go ×1
value, err := sadefs.DecodeValue(payload, enumspb.INDEXED_VALUE_TYPE_UNSPECIFIED, false)
if err != nil {
}
case enumspb.INDEXED_VALUE_TYPE_BOOL:
return VisibilityValueBool(value.(bool)), nil
return VisibilityValueTime(value.(time.Time)), nil
case enumspb.INDEXED_VALUE_TYPE_DOUBLE:
return VisibilityValueFloat64(value.(float64)), nil
case enumspb.INDEXED_VALUE_TYPE_INT:
return VisibilityValueInt64(value.(int64)), nil
case enumspb.INDEXED_VALUE_TYPE_KEYWORD:
return VisibilityValueKeyword(value.(string)), nil
case enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST:
return VisibilityValueStringSlice(value.([]string)), nil
case enumspb.INDEXED_VALUE_TYPE_TEXT:
return VisibilityValueText(value.(string)), nil
default:
// this should never happen given that DecodeValue did not return an error
return nil, fmt.Errorf("unexpected metadata type %s", t)
}
}