Skip to content

Commit

Permalink
update code for breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjohnsonpint committed Jan 30, 2025
1 parent 2ff22c3 commit 61e2017
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modus101/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ func FetchQuoteAddToDB() (uint, error) {
return 0, err
}

rows, err := pg.Execute("postgres", "INSERT INTO quotes (quote, author, info) VALUES ($1, $2, $3)", quote.Quote, quote.Author, *info)
res, err := pg.Execute("postgres", "INSERT INTO quotes (quote, author, info) VALUES ($1, $2, $3)", quote.Quote, quote.Author, *info)
if err != nil {
return 0, err
}

return rows, nil
return uint(res.RowsAffected), nil
}

// Quote including author information
Expand All @@ -102,10 +102,10 @@ type DBQuote struct {

// Fetch all quotes from database
func FetchQuotesFromDB() ([]DBQuote, error) {
rows, _, err := pg.Query[DBQuote]("postgres", "SELECT quote, author, info FROM quotes")
res, err := pg.Query[DBQuote]("postgres", "SELECT quote, author, info FROM quotes")
if err != nil {
return nil, err
}

return rows, nil
return res.Rows, nil
}

0 comments on commit 61e2017

Please sign in to comment.