Skip to content

Commit

Permalink
db: init props to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Oct 1, 2020
1 parent e265c56 commit bcc8f45
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,18 @@ func Init() {
ioutil.WriteFile(promkeyF, []byte(promkey), os.ModePerm)
}

Props.SetDefaultInt64("count_users_members", queryCount(db.Build().Se("*").Fr(cTableUsers).Wh("is_member", "1").Exe()))
Props.SetDefaultInt64("count_users_banned", queryCount(db.Build().Se("*").Fr(cTableUsers).Wh("is_banned", "1").Exe()))
Props.SetDefaultInt64("count_users_members", 0)
Props.SetDefaultInt64("count_users_banned", 0)
Props.SetDefaultInt64("count_users_members_max", 0)
Props.SetDefaultInt64("count_users_online", 0)

for _, item := range ResourceTables {
Props.SetDefaultInt64("count_"+item, db.QueryRowCount(item))
Props.SetDefaultInt64("count_"+item, 0)
}
for _, item := range (Channel{}.All()) {
tn := cTableMessagesPrefix + item.UUID.String()
Props.SetDefaultInt64("count_"+tn, db.QueryRowCount(tn))
Props.SetDefaultInt64("count_"+tn, 0)
Props.SetDefaultInt64("count_"+tn+"_edits", 0)
Props.SetDefaultInt64("count_"+tn+"_deletes", 0)
}
for i := 1; i < ActionLen(); i++ {
Expand Down

0 comments on commit bcc8f45

Please sign in to comment.