add comment repository for postgres.
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-03-27 13:56:51 +01:00
parent 21b7b44159
commit e4761ad4a0
11 changed files with 264 additions and 43 deletions
+12 -4
View File
@@ -83,10 +83,6 @@ func main() {
hideList := make(map[string]bool)
if parts[1] != "story" && parts[1] != "chapter" {
continue
}
log.Println("Loaded", parts[1], parts[2], "from archive.")
switch parts[1] {
@@ -159,6 +155,10 @@ func main() {
log.Fatalln("Could not parse story:", parts[2], err)
}
if *flagReplace {
_ = db.Stories().Delete(ctx, story)
}
_, err = db.Stories().Insert(ctx, story)
if err != nil {
log.Fatalln("Could not insert story:", parts[2], err)
@@ -179,6 +179,10 @@ func main() {
log.Fatalln("Could not parse story:", parts[2], err)
}
if *flagReplace {
_ = db.Chapters().Delete(ctx, chapter)
}
_, err = db.Chapters().Insert(ctx, chapter)
if err != nil {
log.Fatalln("Could not insert story:", parts[2], err)
@@ -199,6 +203,10 @@ func main() {
log.Fatalln("Could not parse story:", parts[2], err)
}
if *flagReplace {
_ = db.Comments().Delete(ctx, comment)
}
_, err = db.Comments().Insert(ctx, comment)
if err != nil {
log.Fatalln("Could not insert story:", parts[2], err)