db: add TotalRevisions() implementation
This commit is contained in:
parent
55796153b3
commit
db1ac7c3ad
11
DB.go
11
DB.go
@ -104,6 +104,17 @@ func (this *WikiDB) GetLatestVersion(title string) (*Article, error) {
|
|||||||
return this.parseArticle(row)
|
return this.parseArticle(row)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *WikiDB) TotalRevisions() (int64, error) {
|
||||||
|
row := this.db.QueryRow(`SELECT COUNT(*) c FROM articles`)
|
||||||
|
var ret int64
|
||||||
|
err := row.Scan(&ret)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (this *WikiDB) ListTitles() ([]string, error) {
|
func (this *WikiDB) ListTitles() ([]string, error) {
|
||||||
rows, err := this.db.Query(`SELECT title FROM titles ORDER BY title ASC`)
|
rows, err := this.db.Query(`SELECT title FROM titles ORDER BY title ASC`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user