Post-Migrator/services/migration/get-all-migrated-post-ids.go

25 lines
473 B
Go
Raw Normal View History

2024-05-17 18:49:55 +00:00
package migration
import (
"database/sql"
"federated.computer/wp-sync-slowtwitch/services/shared"
)
func GetAllMigratedPostIds(db *sql.DB) ([]int, error) {
var output []int
rows, err := db.Query("SELECT SlowtwitchId FROM PostResults")
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
}