MCPcopy
hub / github.com/elastic/go-elasticsearch / formatDuration

Function formatDuration

esapi/esapi.go:66–71  ·  view source on GitHub ↗

formatDuration converts duration to a string in the format accepted by Elasticsearch.

(d time.Duration)

Source from the content-addressed store, hash-verified

64// formatDuration converts duration to a string in the format
65// accepted by Elasticsearch.
66func formatDuration(d time.Duration) string {
67 if d < time.Millisecond {
68 return strconv.FormatInt(int64(d), 10) + "nanos"
69 }
70 return strconv.FormatInt(int64(d)/int64(time.Millisecond), 10) + "ms"
71}

Callers 15

DoMethod · 0.85
DoMethod · 0.85
DoMethod · 0.85
DoMethod · 0.85
DoMethod · 0.85
DoMethod · 0.85
DoMethod · 0.85
DoMethod · 0.85
DoMethod · 0.85
DoMethod · 0.85
DoMethod · 0.85
DoMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestAPIHelpersFunction · 0.68