mirror of
https://github.com/owncast/owncast.git
synced 2024-11-24 21:59:43 +03:00
0b5d7c8a4d
* WIP * fix(test): fix ap test failing * fix: fix unkeyed fields being used * chore(tests): clean up browser tests by splitting out federation UI tests
18 lines
378 B
Go
18 lines
378 B
Go
package data
|
|
|
|
// GetMessagesCount will return the number of messages in the database.
|
|
func GetMessagesCount() int64 {
|
|
query := `SELECT COUNT(*) FROM messages`
|
|
rows, err := _db.Query(query)
|
|
if err != nil || rows.Err() != nil {
|
|
return 0
|
|
}
|
|
defer rows.Close()
|
|
var count int64
|
|
for rows.Next() {
|
|
if err := rows.Scan(&count); err != nil {
|
|
return 0
|
|
}
|
|
}
|
|
return count
|
|
}
|