repository

package
v0.0.0-...-e4dec06 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL