database

package
v0.0.0-...-9a5398c Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseConnection

func CloseConnection()

func GetConnection

func GetConnection(ctx context.Context) *gorm.DB

func GetReporterTopFollowersUserById

func GetReporterTopFollowersUserById(ctx context.Context, reporterId string) ([]map[string]interface{}, error)

func GetReporterTweetsHour

func GetReporterTweetsHour(ctx context.Context) (map[int]int, error)

func GetReporterTweetsLanguagesCountries

func GetReporterTweetsLanguagesCountries(ctx context.Context) (map[string]map[string]int, error)

func Migrate

func Migrate() error

Types

type ReporterModel

type ReporterModel struct {
	Id     string `gorm:"primary_key"`
	Tag    string
	Tweets []TwitterTweetModel `gorm:"foreignkey:Reporter;association_foreignkey:Id"`
}

func GetReporterById

func GetReporterById(ctx context.Context, reporterId string) (ReporterModel, error)

func (ReporterModel) TableName

func (ReporterModel) TableName() string

type TwitterTweetModel

type TwitterTweetModel struct {
	Id          float64 `gorm:"primary_key"`
	Reporter    string
	TwitterUser float64
	Text        string
	Language    string
	CreatedAt   time.Time
}

func GetTwitterTweets

func GetTwitterTweets(ctx context.Context, day time.Time) ([]TwitterTweetModel, error)

func (TwitterTweetModel) TableName

func (TwitterTweetModel) TableName() string

type TwitterUserModel

type TwitterUserModel struct {
	Id             float64 `gorm:"primary_key"`
	Name           string
	ScreenName     string
	StatusesCount  float64
	FollowersCount float64
	Location       string
	Tweets         []TwitterTweetModel `gorm:"foreignkey:TwitterUser;association_foreignkey:Id"`
}

func (TwitterUserModel) TableName

func (TwitterUserModel) TableName() string

Jump to

Keyboard shortcuts

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