db

package
v0.0.0-...-ad4c16b Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConnection

func CreateConnection(dburl string) error

CreateConnection creates a re-useable global database connection

func CreateTweetPair

func CreateTweetPair(tx *sql.Tx, tweet1IDStr string, tweet2IDStr string) (pair model.TweetPair, err error)

CreateTweetPair creates a new pair given the two tweet IDs, if necessary

func GetMostRecentTweet

func GetMostRecentTweet(tx *sql.Tx, author model.TweetAuthor, before time.Time) (t model.DBTweet, err error)

GetMostRecentTweet recovers the most recent tweet for a given presidential author

func GetNewerTweet

func GetNewerTweet(tx *sql.Tx, tweet model.DBTweet, author model.TweetAuthor) (t model.DBTweet, err error)

GetNewerTweet recovers the next newest tweet by the same author

func GetOlderTweet

func GetOlderTweet(tx *sql.Tx, tweet model.DBTweet, author model.TweetAuthor) (t model.DBTweet, err error)

GetOlderTweet recovers the next oldest tweet by the same author

func GetTweetPairByShortID

func GetTweetPairByShortID(tx *sql.Tx, shortID string) (pair model.TweetPair, err error)

GetTweetPairByShortID looks up a tweet pair by the pair's short ID

func GetTweetPairByTweets

func GetTweetPairByTweets(tx *sql.Tx, tweet1IDStr string, tweet2IDStr string) (pair model.TweetPair, err error)

GetTweetPairByTweets looks up a tweet pair by its two constituent tweets

func GetTweetsFromIDs

func GetTweetsFromIDs(tx *sql.Tx, StrIDs []string) (tweetMap map[string]model.DBTweet, err error)

GetTweetsFromIDs recovers any tweets available for the given IDs

func InsertTweet

func InsertTweet(tx *sql.Tx, tw model.DBTweet) error

InsertTweet inserts a tweet into the transaction

func NewTransaction

func NewTransaction() (tx *sql.Tx, err error)

NewTransaction creates a new transaction in the global database

func RunMigrations

func RunMigrations() (err error)

RunMigrations attempts to run database migrations on the global database

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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