MCPcopy
hub / github.com/perkeep/perkeep / typeOfKey

Function typeOfKey

pkg/index/keys.go:35–52  ·  view source on GitHub ↗

type of key returns the identifier in k before the first ":" or "|". (Originally we packed keys by hand and there are a mix of styles)

(k string)

Source from the content-addressed store, hash-verified

33// type of key returns the identifier in k before the first ":" or "|".
34// (Originally we packed keys by hand and there are a mix of styles)
35func typeOfKey(k string) string {
36 c := strings.Index(k, ":")
37 p := strings.Index(k, "|")
38 if c < 0 && p < 0 {
39 return ""
40 }
41 if c < 0 {
42 return k[:p]
43 }
44 if p < 0 {
45 return k[:c]
46 }
47 min := c
48 if p < min {
49 min = p
50 }
51 return k[:min]
52}
53
54type keyType struct {
55 name string

Callers 4

Exp_TypeOfKeyFunction · 0.85
initFunction · 0.85
scanPrefixMethod · 0.85
addBlobMethod · 0.85

Calls 1

IndexMethod · 0.80

Tested by 1

Exp_TypeOfKeyFunction · 0.68