Added initial Settings

This commit is contained in:
Pablu23
2024-04-02 19:05:36 +02:00
parent c83a10823d
commit e45109fcd5
8 changed files with 148 additions and 11 deletions

View File

@@ -88,6 +88,16 @@ func (d *DbTable[K, T]) All() []T {
return res
}
func (d *DbTable[K, T]) Map() map[K]T {
d.mutex.Lock()
defer d.mutex.Unlock()
res := make(map[K]T, len(d.items))
for k, manga := range d.items {
res[k] = manga
}
return res
}
func (d *DbTable[K, T]) Delete(db *sql.DB, key K) error {
d.mutex.Lock()
defer d.mutex.Unlock()