BREAKING CHANGE: Guardar contenido

This commit is contained in:
Cat /dev/Nulo 2022-10-12 12:53:15 -03:00
parent ce90f0be32
commit 099148a34b
6 changed files with 20 additions and 7 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "go-rss"]
path = go-rss
url = https://gitea.nulo.in/Nulo/go-rss

View file

@ -51,11 +51,12 @@ func (fetcher GenericRSSFetcher) Fetch() {
formatted_pub_date := parsedDate.Format(DefaultDateFormat)
_, err = fetcher.DB.Exec(`
INSERT INTO notas(medio, title, link, publication_date)
VALUES(?, ?, ?, ?)
INSERT INTO notas(medio, title, content, link, publication_date)
VALUES(?, ?, ?, ?, ?)
ON CONFLICT(link) DO UPDATE SET
title=excluded.title;
`, fetcher.MedioName, entry.Title, entry.Link, formatted_pub_date)
title=excluded.title,
content=excluded.content;
`, fetcher.MedioName, entry.Title, entry.ContentEncoded, entry.Link, formatted_pub_date)
if err != nil {
log.Println("Error when saving nota", err)
}

1
go-rss Submodule

@ -0,0 +1 @@
Subproject commit 1b4d16383269a0a2b5e51aae3d166a7cb1978a9f

9
go.mod
View file

@ -3,7 +3,10 @@ module medios.nulo.in/web
go 1.19
require (
github.com/mattn/go-sqlite3 v1.14.15 // indirect
github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c // indirect
github.com/ungerik/go-rss v0.0.0-20200405130036-81ac15598626 // indirect
github.com/mattn/go-sqlite3 v1.14.15
github.com/ungerik/go-rss v0.0.0-20200405130036-81ac15598626
)
require github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c // indirect
replace github.com/ungerik/go-rss => ./go-rss

4
go.sum
View file

@ -1,3 +1,7 @@
gitea.nulo.in/Nulo/go-rss v0.0.0-20200405130036-81ac15598626 h1:QkC7ZtrV7w6LON50hPGuXOz6J4196WIuCC+jRnYFlko=
gitea.nulo.in/Nulo/go-rss v0.0.0-20200405130036-81ac15598626/go.mod h1:UeGmbG1AM6Cx0FfruZOzOC02lDvXbUWV+06tAxgCoGA=
gitea.nulo.in/Nulo/go-rss v0.0.0-20221012153719-f25f0ae1f12e h1:kd56QKzyFz2ALRN5ITosKINKKo+hPLn4EW2agt2eUOM=
gitea.nulo.in/Nulo/go-rss v0.0.0-20221012153719-f25f0ae1f12e/go.mod h1:UeGmbG1AM6Cx0FfruZOzOC02lDvXbUWV+06tAxgCoGA=
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c h1:P6XGcuPTigoHf4TSu+3D/7QOQ1MbL6alNwrGhcW7sKw=

View file

@ -1,6 +1,7 @@
CREATE TABLE notas (
medio TEXT NOT NULL,
title TEXT NOT NULL,
content TEXT,
link TEXT NOT NULL,
publication_date DATETIME NOT NULL,
created_at DATETIME NOT NULL DEFAULT current_timestamp,