Got app working
This commit is contained in:
@@ -53,7 +53,7 @@ func check_password(filename, attempt string) (result bool) {
|
||||
return
|
||||
}
|
||||
|
||||
func loadChildren(filename string) (children []Child) {
|
||||
func loadChildren(filename string) (children map[string]int) {
|
||||
dbMutex.RLock()
|
||||
defer dbMutex.RUnlock()
|
||||
b, err := ioutil.ReadFile(filename)
|
||||
@@ -66,3 +66,14 @@ func loadChildren(filename string) (children []Child) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func dumpChildren(filename string, children map[string]int) {
|
||||
dbMutex.Lock()
|
||||
defer dbMutex.Unlock()
|
||||
b, err := json.Marshal(children)
|
||||
err = ioutil.WriteFile(filename, b, 0644)
|
||||
if err != nil {
|
||||
log.Fatal("serious issue writing children db file", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user