38 lines
542 B
Go
38 lines
542 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"database/sql"
|
||
|
)
|
||
|
|
||
|
type Feed struct {
|
||
|
FeedID uuid
|
||
|
URI string
|
||
|
Nick string
|
||
|
LastScanOn sql.NullTime
|
||
|
RefreshRate int
|
||
|
|
||
|
LastModified sql.NullTime
|
||
|
LastError sql.NullString
|
||
|
ETag sql.NullString
|
||
|
|
||
|
DiscloseFeedURL string
|
||
|
DiscloseNick string
|
||
|
|
||
|
Version string
|
||
|
}
|
||
|
|
||
|
func (f *Feed) Save(ctx context.Context, db *sql.DB) error {
|
||
|
_, err := db.ExecContext(
|
||
|
ctx,
|
||
|
updateFeed,
|
||
|
f.LastScanOn,
|
||
|
f.RefreshRate,
|
||
|
f.LastModified,
|
||
|
f.ETag,
|
||
|
f.LastError,
|
||
|
f.FeedID,
|
||
|
)
|
||
|
return err
|
||
|
}
|