v1 blog API routes
This commit is contained in:
parent
fec3325503
commit
eaa2f6587d
9 changed files with 286 additions and 34 deletions
|
|
@ -93,3 +93,18 @@ func UpdateBlogPost(db *sqlx.DB, postID string, post *model.BlogPost) error {
|
|||
|
||||
return err
|
||||
}
|
||||
|
||||
func DeleteBlogPost(db *sqlx.DB, postID string) (int64, error) {
|
||||
result, err := db.Exec(
|
||||
"DELETE FROM blogpost "+
|
||||
"WHERE id=$1",
|
||||
postID,
|
||||
)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
rowsAffected, _ := result.RowsAffected()
|
||||
|
||||
return rowsAffected, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue