add TotalTootCount database method

This commit is contained in:
Jeffrey Paul 2020-04-09 03:06:30 -07:00
parent 95bb0aa301
commit 8dbd92abbd

View File

@ -14,6 +14,16 @@ func (m *Manager) TootCountForHostname(hostname string) (uint, error) {
} }
} }
func (m *Manager) TotalTootCount() (uint, error) {
var c uint
e := m.db.Model(&StoredToot{}).Count(&c)
if e.Error != nil {
return 0, e.Error
} else {
return c, nil
}
}
func (m *Manager) GetAPInstanceFromUUID(uuid *uuid.UUID) (*APInstance, error) { func (m *Manager) GetAPInstanceFromUUID(uuid *uuid.UUID) (*APInstance, error) {
var i APInstance var i APInstance
e := m.db.Model(&APInstance{}).Where("uuid = ?", uuid).First(&i) e := m.db.Model(&APInstance{}).Where("uuid = ?", uuid).First(&i)