Documentation ¶
Index ¶
- type NewsFeedRepository
- func (r *NewsFeedRepository) CleanupNews(days int)
- func (r *NewsFeedRepository) CreateNews(news model.RssNews)
- func (r *NewsFeedRepository) Delete(id int)
- func (r *NewsFeedRepository) FindAll() model.NewsFeeds
- func (r *NewsFeedRepository) FindAllByTokens(tokens []string) []model.RssNews
- func (r *NewsFeedRepository) FindNews(feedId int, uid string) *model.RssNews
- func (r *NewsFeedRepository) FindRecentNews(count int) []model.RssNews
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NewsFeedRepository ¶
type NewsFeedRepository struct {
// contains filtered or unexported fields
}
func NewNewsFeedRepository ¶
func NewNewsFeedRepository(db *sql.DB) *NewsFeedRepository
func (*NewsFeedRepository) CleanupNews ¶
func (r *NewsFeedRepository) CleanupNews(days int)
func (*NewsFeedRepository) CreateNews ¶
func (r *NewsFeedRepository) CreateNews(news model.RssNews)
rss_news: id,feed_id,timestamp,title,url,uid
func (*NewsFeedRepository) Delete ¶
func (r *NewsFeedRepository) Delete(id int)
id,text,created,closed,state,prio
func (r *NewsFeedRepository) Get(id int) *model.NewsFeed { row := r.db.QueryRow("SELECT id,text,created,closed,state,prio from NewsFeeds WHERE id = $1", id) t := new(model.NewsFeed) err := row.Scan(&t.ID, &t.Text, &t.Created, &t.Closed, &t.State, &t.Prio) if err == sql.ErrNoRows { return nil } return t }
func (r *NewsFeedRepository) Update(NewsFeed model.NewsFeed) *model.NewsFeed { _, err := r.db.Exec("UPDATE NewsFeeds set text = $1,closed = $2, state = $3,prio = $4 where id = $5", NewsFeed.Text, NewsFeed.Closed, NewsFeed.State, NewsFeed.Prio, NewsFeed.ID) if err != nil { log.Fatal(err) } return &NewsFeed }
func (*NewsFeedRepository) FindAll ¶
func (r *NewsFeedRepository) FindAll() model.NewsFeeds
func (*NewsFeedRepository) FindAllByTokens ¶
func (r *NewsFeedRepository) FindAllByTokens(tokens []string) []model.RssNews
func (*NewsFeedRepository) FindNews ¶
func (r *NewsFeedRepository) FindNews(feedId int, uid string) *model.RssNews
func (*NewsFeedRepository) FindRecentNews ¶
func (r *NewsFeedRepository) FindRecentNews(count int) []model.RssNews
Click to show internal directories.
Click to hide internal directories.