db

package
v0.0.0-...-6f2fffe Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorCount

type AuthorCount struct {
	Author string `json:"author" db:"author"`
	Count  int    `json:"count" db:"cou"`
}

type DatabaseConnectionSecret

type DatabaseConnectionSecret struct {
	Password string `json:"password"`
	Server   string `json:"server"`
	User     string `json:"user"`
	Database string `json:"database"`
	Port     int
}

type MyDB

type MyDB struct {
	DB   *sql.DB
	Name string
}

func InitDB

func InitDB() MyDB

func (*MyDB) AddComment

func (db *MyDB) AddComment(p reddit.PostComment) error

func (*MyDB) AddPost

func (db *MyDB) AddPost(p reddit.SubredditPost) error

func (*MyDB) AddSubreddit

func (db *MyDB) AddSubreddit(s reddit.Subreddit) error

func (*MyDB) GetAverageSentimentOfSubreddits

func (db *MyDB) GetAverageSentimentOfSubreddits() ([]SubredditAvgSentiment, error)

func (*MyDB) GetComments

func (db *MyDB) GetComments(subreddit, postID string) ([]reddit.PostComment, error)

func (*MyDB) GetPosts

func (db *MyDB) GetPosts(subreddit string) ([]reddit.SubredditPost, error)

func (*MyDB) GetPostsBetweenDates

func (db *MyDB) GetPostsBetweenDates(now, then string) ([]reddit.SubredditPost, error)

func (*MyDB) GetSubredditNames

func (db *MyDB) GetSubredditNames() ([]string, error)

func (*MyDB) GetTopAuthorsPerSubreddit

func (db *MyDB) GetTopAuthorsPerSubreddit(subredditName string) ([]AuthorCount, error)

func (*MyDB) GetTopLevelComments

func (db *MyDB) GetTopLevelComments(postID string) ([]reddit.PostComment, error)

func (*MyDB) SubredditSearch

func (db *MyDB) SubredditSearch(searchValue string) ([]reddit.Subreddit, error)

func (*MyDB) SubredditSentiment

func (db *MyDB) SubredditSentiment(subredditID string) (SubredditSentiment, error)

func (*MyDB) TopicOccurance

func (db *MyDB) TopicOccurance(subredditID string) ([]TopicCount, error)

func (*MyDB) UpdatePost

func (db *MyDB) UpdatePost(p reddit.SubredditPost) error

func (*MyDB) UpdateTopic

func (db *MyDB) UpdateTopic(PostID string, topic string) error

type SubredditAvgSentiment

type SubredditAvgSentiment struct {
	Name    string  `json:"name" db:"name"`
	Average float32 `json:"average" db:"average"`
}

type SubredditSentiment

type SubredditSentiment struct {
	PostSentiment    float64 `json:"postSent" db:"postSent"`
	PostPositive     float64 `json:"postSentPos" db:"postSentPos"`
	PostNegative     float64 `json:"postSentNeg" db:"postSentNeg"`
	PostNeutral      float64 `json:"postSentNeu" db:"postSentNeu"`
	CommentSentiment float64 `json:"commentSent" db:"commentSent"`
	CommentPositive  float64 `json:"commentSentPos" db:"commentSentPos"`
	CommentNegative  float64 `json:"commentSentNeg" db:"commentSentNeg"`
	CommentNeutral   float64 `json:"commentSentNeu" db:"commentSentNeu"`
}

type TopicCount

type TopicCount struct {
	Topic string `json:"topic" db:"topic"`
	Count int    `json:"count" db:"cou"`
}

Jump to

Keyboard shortcuts

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