Skip to content

Commit 3859c00

Browse files
lvan100lianghuan
authored andcommitted
feat(flatten): add Lookup
1 parent 8dde2fc commit 3859c00

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

flatten/store.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,17 @@ func (s *Storage) Get(key string, def ...string) string {
237237
return v.Value
238238
}
239239

240+
// Lookup retrieves the value associated with the given flattened key.
241+
// Returns the value and true if the key is found, or an empty string and
242+
// false if the key is not found.
243+
func (s *Storage) Lookup(key string) (string, bool) {
244+
v, ok := s.data[key]
245+
if !ok {
246+
return "", false
247+
}
248+
return v.Value, true
249+
}
250+
240251
// Set inserts or updates a flattened key with the given value and
241252
// the index of the file it originated from.
242253
//

0 commit comments

Comments
 (0)