1
0
mirror of https://github.com/garraflavatra/go-fmp.git synced 2025-07-12 01:24:05 +00:00
This commit is contained in:
2025-06-14 15:19:36 +02:00
parent d9ffc3e573
commit b94fa28ba9
7 changed files with 49 additions and 65 deletions

View File

@ -47,10 +47,11 @@ type FmpDictEntry struct {
}
type FmpTable struct {
ID uint64
Name string
}
func (dict *FmpDict) get(path []uint64) *FmpDictEntry {
func (dict *FmpDict) GetEntry(path []uint64) *FmpDictEntry {
for i, key := range path {
_, ok := (*dict)[key]
if !ok {
@ -61,20 +62,23 @@ func (dict *FmpDict) get(path []uint64) *FmpDictEntry {
return (*dict)[key]
} else {
dict = (*dict)[key].Children
if dict == nil {
return nil
}
}
}
return nil
}
func (dict *FmpDict) getValue(path []uint64) []byte {
ent := dict.get(path)
func (dict *FmpDict) GetValue(path []uint64) []byte {
ent := dict.GetEntry(path)
if ent != nil {
return ent.Value
}
return nil
}
func (dict *FmpDict) set(path []uint64, value []byte) {
func (dict *FmpDict) SetValue(path []uint64, value []byte) {
for i, key := range path {
_, ok := (*dict)[key]
if !ok {