@@ -89,8 +89,14 @@ func Make[K comparable, V string | []byte | bool | uint64 | uint32 | uint16 | ui
8989 for k , v := range m {
9090 switch val := any (v ).(type ) {
9191 case []byte :
92+ if len (val ) == 0 {
93+ continue
94+ }
9295 mapping [comparableToString (k )] = val
9396 case string :
97+ if len (val ) == 0 {
98+ continue
99+ }
94100 mapping [comparableToString (k )] = []byte (val )
95101 case bool :
96102 if val {
@@ -117,28 +123,27 @@ func Make[K comparable, V string | []byte | bool | uint64 | uint32 | uint16 | ui
117123 }
118124 }
119125
126+ // handle the empty map case
127+ if len (mapping ) == 0 {
128+ return []byte {bitLimit }
129+ }
130+
120131 // real impl
121132 return create (mapping , bitLimit )
122- // scaffold Implementation
123- return MakeScaffold (mapping , bitLimit )
124133}
125134
126135// Get retrieves an item based on comparable key and value bit size
127136func Get [K comparable ](f []byte , valBitSize uint64 , key K ) []byte {
128137 k := comparableToString (key )
129138 // real impl
130139 return get (f , []byte (k ), valBitSize )
131- // scaffold Implementation
132- return GetScaffold (f , valBitSize , k )
133140}
134141
135142// GetBool retrieves a bool based on comparable key
136143func GetBool [K comparable ](f []byte , key K ) bool {
137144 k := comparableToString (key )
138145 // real impl
139146 return get (f , []byte (k ), 1 )[0 ] == 1
140- // scaffold Implementation
141- return GetScaffold (f , 1 , k )[0 ] == 1
142147}
143148
144149// GetNum retrieves a number based on comparable key and value bit size
@@ -150,7 +155,5 @@ func GetNum[K comparable](f []byte, valBitSize uint64, key K) uint64 {
150155 copy (buf [8 - len (b ):8 ], b )
151156 return binary .BigEndian .Uint64 (buf [:])
152157
153- // scaffold Implementation
154- //b := GetScaffold(f, valBitSize, k)
155158
156159}
0 commit comments