go.temporal.io/server/common/util/strings.go

19 LOC · 10 covered · 9 uncovered · 7 ranges · 18 concepts · 5 introducers · 13 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.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the fileretry.go ×1 · 7 introduced LOCretry.go ×1TestRetryActivity_should_clear_per_attempt_fields, TestRetryActivity_should_be_scheduled_when_next_backoff_interval_can_be_calculated · 0 introduced LOCTestRetryActivity_should…mutable_state_impl.go ×1 · 2 introduced LOCmutable_state_impl.go ×1mutable_state_impl.go ×2 · 20 introduced LOCmutable_state_impl.go ×2visibility_store.go ×2 · 4 introduced LOCvisibility_store.go ×2truncation_respects_multi-byte_UTF-8_boundary · 0 introduced LOCtruncation_respects_mult…service_error_interceptor.go ×1 · 4 introduced LOCservice_error_intercepto…TestTruncateUTF8 · 0 introduced LOCTestTruncateUTF8failure.go ×1 · 5 introduced LOCfailure.go ×1failure.go ×1 · 2 introduced LOCfailure.go ×1failure.go ×1 · 3 introduced LOCfailure.go ×1failure.go ×6 · 19 introduced LOCfailure.go ×6TestTruncateUTF8 · 0 introduced LOCTestTruncateUTF8strings.go ×1 · 2 introduced LOCstrings.go ×1strings.go ×1 · 2 introduced LOCstrings.go ×1strings.go ×2 · 2 introduced LOCstrings.go ×2strings.go ×1 · 1 introduced LOCstrings.go ×1strings.go ×2 · 3 introduced LOCstrings.go ×2TestTruncate · introduced test · go.temporal.io/server/common/failure/TestTruncateTestTruncateTestTruncateDepth · introduced test · go.temporal.io/server/common/failure/TestTruncateDepthTestTruncateDepthTestTruncateUTF8 · introduced test · go.temporal.io/server/common/failure/TestTruncateUTF8TestTruncateUTF8Test_GetDocID · introduced test · go.temporal.io/server/common/persistence/visibility/store/elasticsearch/TestESVisibilitySuite/Test_GetDocIDTest_GetDocIDmessage_over_limit_is_truncated · introduced test · go.temporal.io/server/common/rpc/interceptor/TestServiceErrorInterceptorTruncation/message_over_limit_is_truncatedmessage_over_limit_is_tr…truncation_preserves_error_code · introduced test · go.temporal.io/server/common/rpc/interceptor/TestServiceErrorInterceptorTruncation/truncation_preserves_error_codetruncation_preserves_err…truncation_respects_multi-byte_UTF-8_boundary · introduced test · go.temporal.io/server/common/rpc/interceptor/TestServiceErrorInterceptorTruncation/truncation_respects_multi-byte_UTF-8_boundarytruncation_respects_mult…TestTruncateUTF8 · introduced test · go.temporal.io/server/common/util/TestTruncateUTF8TestTruncateUTF8TestRetryActivity_next_retry_delay_should_override_max_interval · introduced test · go.temporal.io/server/service/history/workflow/TestMutableStateRetryActivitySuite/TestRetryActivity_next_retry_delay_should_override_max_intervalTestRetryActivity_next_r…TestRetryActivity_should_be_scheduled_when_next_backoff_interval_can_be_calculated · introduced test · go.temporal.io/server/service/history/workflow/TestMutableStateRetryActivitySuite/TestRetryActivity_should_be_scheduled_when_next_backoff_interval_can_be_calculatedTestRetryActivity_should…TestRetryActivity_should_be_scheduled_when_next_retry_delay_is_set · introduced test · go.temporal.io/server/service/history/workflow/TestMutableStateRetryActivitySuite/TestRetryActivity_should_be_scheduled_when_next_retry_delay_is_setTestRetryActivity_should…TestRetryActivity_should_clear_per_attempt_fields · introduced test · go.temporal.io/server/service/history/workflow/TestMutableStateRetryActivitySuite/TestRetryActivity_should_clear_per_attempt_fieldsTestRetryActivity_should…TestRetryActivity_when_task_can_not_be_generated_should_fail · introduced test · go.temporal.io/server/service/history/workflow/TestMutableStateRetryActivitySuite/TestRetryActivity_when_task_can_not_be_generated_should_failTestRetryActivity_when_t…Focused file · go.temporal.io/server/common/util/strings.go · 19 LOCutil/strings.go

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.

1 package util
2
3 import "unicode/utf8"
4
5 // TruncateUTF8 truncates s to no more than n _bytes_, and returns a valid utf-8 string as long
6 // as the input is a valid utf-8 string.
7 // Note that truncation pays attention to codepoints only! This may truncate in the middle of a
8 // grapheme cluster.
9 > func TruncateUTF8(s string, n int) string { strings.go ×2
10 > if len(s) <= n {
11 > return s strings.go ×1
12 > } else if n <= 0 { strings.go ×2
13 > return "" strings.go ×1
14 > }
15 > for n > 0 && !utf8.RuneStart(s[n]) { strings.go ×2
16 > n-- strings.go ×1
17 > }
18 > return s[:n] strings.go ×2
19 }