Post-Migrator/services/slowtwitch/get-all-post-ids.go

25 lines
481 B
Go

package slowtwitch
import (
"database/sql"
"federated.computer/wp-sync-slowtwitch/services/shared"
)
func GetAllPostIds(db *sql.DB) ([]int, error) {
var output []int
rows, err := db.Query("SELECT ID as Id FROM glinks_Links order by Add_Date")
if err != nil {
return output, err
}
defer rows.Close()
for rows.Next() {
var id shared.Id
err = rows.Scan(&id.Id)
if err != nil {
return output, err
}
output = append(output, int(id.Id))
}
return output, nil
}