File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ prefix. The implementation allows the user to associate data with each
10
10
string, so it can act as a sort of flexible key-value store where
11
11
searches succeed with the shortest unambiguous key prefix.
12
12
13
+ This is version 2 of the package, which you can retrieve using ` go get ` :
14
+
15
+ ``` sh
16
+ go get github.com/beevik/prefixtree/v2
17
+ ```
18
+
13
19
### Example: Building a prefix tree
14
20
15
21
The following code adds strings and associated data (in this case an integer)
@@ -52,7 +58,7 @@ for _, prefix := range []string{
52
58
" lemon meringue" ,
53
59
" pear" ,
54
60
} {
55
- value , err := tree.Find (prefix)
61
+ value , err := tree.FindValue (prefix)
56
62
fmt.Printf (" %-18s %-8v %v \n " , prefix, value, err)
57
63
}
58
64
```
@@ -68,7 +74,7 @@ apple p 30 <nil>
68
74
apple pie 30 <nil>
69
75
apple pies 0 prefixtree: prefix not found
70
76
o 20 <nil>
71
- orang 20 <nil>
77
+ oran 20 <nil>
72
78
orange 20 <nil>
73
79
oranges 0 prefixtree: prefix not found
74
80
l 0 prefixtree: prefix ambiguous
You can’t perform that action at this time.
0 commit comments