Skip to content

Commit

Permalink
Remove deprecated APIs that should have been removed in 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
beevik committed May 29, 2024
1 parent 1fb9fd5 commit 2dcd17a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func ExampleTree_usage() {
"lemon meringue",
"lemon meringues",
} {
value, err := tree.Find(s)
value, err := tree.FindValue(s)
fmt.Printf("%-18s %-8v %v\n", s, value, err)
}

Expand Down
16 changes: 0 additions & 16 deletions prefixtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,6 @@ func (t *Tree) isTerminal() bool {
return t.key != ""
}

// Find searches the prefix tree for all key strings prefixed by the
// provided prefix and returns them.
//
// Deprecated: Use FindValue instead.
func (t *Tree) Find(prefix string) (value any, err error) {
return t.FindValue(prefix)
}

// FindAll searches the prefix tree for all key strings prefixed by the
// provided prefix. All associated values are returned.
//
// Deprecated: Use FindValues instead.
func (t *Tree) FindAll(prefix string) (values []any) {
return t.FindValues(prefix)
}

// FindKey searches the prefix tree for a key string that uniquely matches the
// prefix. If found, the full matching key is returned. If not found,
// ErrPrefixNotFound is returned. If the prefix matches more than one key in
Expand Down
8 changes: 4 additions & 4 deletions prefixtree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func test(t *testing.T, entries []entry, cases []testcase) *Tree {

fail := false
for _, c := range cases {
value, err := tree.Find(c.key)
value, err := tree.FindValue(c.key)
if c.err != nil {
if err != c.err {
fail = true
Expand Down Expand Up @@ -352,7 +352,7 @@ func TestDictionary(t *testing.T) {
"diametrically",
}
for i, key := range keys {
_, err := tree.Find(key)
_, err := tree.FindValue(key)
if err != nil {
t.Errorf("Case %d: Find(\"%s\") encountered error: %v\n", i, key, err)
}
Expand All @@ -366,7 +366,7 @@ func TestDictionary(t *testing.T) {
"dea",
}
for i, key := range keys {
_, err := tree.Find(key)
_, err := tree.FindValue(key)
if err != ErrPrefixAmbiguous {
t.Errorf("Case %d: Find(\"%s\") should have been ambiguous\n", i, key)
}
Expand Down Expand Up @@ -410,7 +410,7 @@ func BenchmarkDictionary(b *testing.B) {
"ruddy",
}
for _, key := range keys {
_, err := tree.Find(key)
_, err := tree.FindValue(key)
if err != nil {
b.Errorf("Find(\"%s\") encountered error: %v\n", key, err)
}
Expand Down

0 comments on commit 2dcd17a

Please sign in to comment.