article sql statement bug fix
This commit is contained in:
@@ -117,7 +117,7 @@ func (m *ArticleRepository) ById(id int) (*model.Article, error) {
|
||||
func (m *ArticleRepository) Insert(a *model.Article) error {
|
||||
// insert article
|
||||
stmt := `INSERT INTO articles (title, sourceUrl, content, publishDate, fetchDate)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
`
|
||||
_, err := m.DB.Exec(stmt, a.Title, a.SourceUrl, a.Content, a.PublishDate, a.FetchDate)
|
||||
return err
|
||||
@@ -128,7 +128,7 @@ func (m *ArticleRepository) Insert(a *model.Article) error {
|
||||
// connection to database fails.
|
||||
func (m *ArticleRepository) Update(a *model.Article) error {
|
||||
stmt := `UPDATE articles
|
||||
SET title = $1, sourceUrl = $2, content = $4, publishDate = $5, fetchDate = $6
|
||||
SET title = $1, sourceUrl = $2, content = $3, publishDate = $4, fetchDate = $5
|
||||
WHERE id = $8
|
||||
`
|
||||
_, err := m.DB.Exec(stmt, a.Title, a.SourceUrl, a.Content, a.PublishDate, a.FetchDate, a.Id)
|
||||
|
||||
Reference in New Issue
Block a user