added tranx route and partially coded

This commit is contained in:
Derek McQuay
2017-02-04 23:54:18 -08:00
parent 162f86c894
commit dc4b1be612
3 changed files with 92 additions and 1 deletions
+17
View File
@@ -84,6 +84,23 @@ func (d *DB) adminUser(e string) bool {
return result.Admin
}
func (d *DB) getTranxs() ([]tranx, error) {
results := []tranx{}
rows, err := d.db.Queryx("SELECT * FROM tranx")
if err != nil {
return nil, err
}
for rows.Next() {
var result tranx
err := rows.StructScan(&result)
if err != nil {
return nil, err
}
results = append(results, result)
}
return results, nil
}
//func (d *DB) checkOwner(filename, client string) error {
// row := d.db.QueryRowx("SELECT client FROM pics WHERE filename = $1", filename)
// var owner string