@@ 68,21 68,6 @@ func (user User) AddPost(post Post) error {
_, err := db.NamedExec(fmt.Sprintf(
`INSERT INTO posts_%s (folder, name, uuid, url, date, title, text, rendered, image, caption, read, fetched)
VALUES (:folder, :name, :uuid, :url, :date, :title, :text, :rendered, :image, :caption, :read, :fetched)`, user.UUID), &post)
-/*
- ON CONFLICT (uuid) DO UPDATE SET
- -- Post data
- url=excluded.url,
- title=excluded.title,
- text=excluded.text,
- -- Rendered post data
- rendered=excluded.rendered,
- image=excluded.image,
- caption=excluded.caption,
- -- Post status info
- read=excluded.read,
- fetched=excluded.fetched
- WHERE excluded.date>posts_%s.date`,
-*/
return err
}
@@ 16,16 16,12 @@ func GetUserBySession(token string) (User, error) {
var uuid string
var user User
- err = db.Get(&uuid,
- "SELECT uuid FROM sessions WHERE token=$1",
- token)
+ err = db.Get(&uuid, "SELECT uuid FROM sessions WHERE token=$1", token)
if err != nil {
return user, err
}
- err = db.Get(&user,
- "SELECT * FROM users WHERE uuid=$1",
- uuid)
+ err = db.Get(&user, "SELECT * FROM users WHERE uuid=$1", uuid)
if err != nil {
return user, err
}