MCPcopy Create free account
hub / github.com/temporalio/temporal / getSearchAttributesSQL

Method getSearchAttributesSQL

service/frontend/admin_handler.go:621–659  ·  view source on GitHub ↗
(
	ctx context.Context,
	request *adminservice.GetSearchAttributesRequest,
	searchAttributes searchattribute.NameTypeMap,
)

Source from the content-addressed store, hash-verified

619}
620
621func (adh *AdminHandler) getSearchAttributesSQL(
622 ctx context.Context,
623 request *adminservice.GetSearchAttributesRequest,
624 searchAttributes searchattribute.NameTypeMap,
625) (*adminservice.GetSearchAttributesResponse, error) {
626 _, client, err := adh.clientFactory.NewLocalFrontendClientWithTimeout(
627 frontend.DefaultTimeout,
628 frontend.DefaultLongPollTimeout,
629 )
630 if err != nil {
631 return nil, serviceerror.NewUnavailablef(errUnableToCreateFrontendClientMessage, err)
632 }
633
634 nsName := request.GetNamespace()
635 if nsName == "" {
636 return nil, errNamespaceNotSet
637 }
638 resp, err := client.DescribeNamespace(
639 ctx,
640 &workflowservice.DescribeNamespaceRequest{Namespace: nsName},
641 )
642 if err != nil {
643 return nil, serviceerror.NewUnavailablef(
644 errUnableToGetNamespaceInfoMessage, nsName, err,
645 )
646 }
647
648 fieldToAliasMap := resp.Config.CustomSearchAttributeAliases
649 customSearchAttributes := make(map[string]enumspb.IndexedValueType)
650 for field, tp := range searchAttributes.Custom() {
651 if alias, ok := fieldToAliasMap[field]; ok {
652 customSearchAttributes[alias] = tp
653 }
654 }
655 return &adminservice.GetSearchAttributesResponse{
656 CustomAttributes: customSearchAttributes,
657 SystemAttributes: searchAttributes.System(),
658 }, nil
659}
660
661func (adh *AdminHandler) RebuildMutableState(
662 ctx context.Context,

Callers 1

GetSearchAttributesMethod · 0.95

Calls 5

CustomMethod · 0.80
SystemMethod · 0.80
GetNamespaceMethod · 0.65
DescribeNamespaceMethod · 0.45

Tested by

no test coverage detected