Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GormModelWithoutID ¶
GormModelWithoutID is an alternative definition for gorm.Model without an ID
type TwitterPost ¶
type TwitterPost struct {
GormModelWithoutID
// meta
PostIdentifier uint64 `gorm:"primary_key:true"`
ConversationID string
Link string
Type string
// time, place
DateTime time.Time
TimeZone string
Geo string
Near string
Place string
// content
Mentions []*TwitterUser `gorm:"many2many:post_mentions;association_foreignkey:username;foreignkey:postIdentifier"`
Photos pq.StringArray `gorm:"type:text[]"`
QuoteURL string
ReplyTo []*TwitterUser `gorm:"many2many:post_replies;association_foreignkey:username;foreignkey:postIdentifier"`
Retweet bool
RetweetDate string
RetweetID string
Source string
Tweet string
URLs pq.StringArray `gorm:"type:text[]"`
Video int
// reactions
LikesCount int
RepliesCount int
RetweetCount int
UserID string
Username string
RetweetUserID string
RetweetUsername string
}
TwitterPost is the struct containing all processed twitter post fields
func ConvertTwitterPost ¶
func ConvertTwitterPost(raw *TwitterPostRaw) *TwitterPost
ConvertTwitterPost converts the raw TwitterPost structure from kafka into the database model
type TwitterPostRaw ¶
type TwitterPostRaw struct {
// meta
ID int `json:"id"`
IDstr string `json:"id_str"`
ConversationID string `json:"conversation_id"`
Link string `json:"link"`
Type string `json:"type"`
// time, place
DateStamp string `json:"datestamp"`
DateTime int `json:"datetime"`
TimeStamp string `json:"timestamp"`
TimeZone string `json:"timezone"`
Geo string `json:"geo"`
Near string `json:"near"`
Place string `json:"place"`
// content
Mentions []string `json:"mentions"`
Photos []string `json:"photos"`
QuoteURL string `json:"quote_url"`
ReplyTo []ReplyUser `json:"reply_to"`
Retweet bool `json:"retweet"`
RetweetDate string `json:"retweet_date"`
RetweetID string `json:"retweet_id"`
Source string `json:"source"`
Tweet string `json:"tweet"`
URLs []string `json:"urls"`
Video int `json:"video"`
// reactions
LikesCount string `json:"likes_count"`
RepliesCount string `json:"replies_count"`
RetweetCount string `json:"retweet_count"`
// user info
Name string `json:"name"`
UserID int `json:"user_id"`
UserIDstr string `json:"user_id_str"`
UserName string `json:"username"`
UserRt string `json:"user_rt"`
UserRtID string `json:"user_tr_id"`
}
TwitterPostRaw is the struct containing all raw twitter post fields
type TwitterUser ¶
type TwitterUser struct {
GormModelWithoutID
// Meta
UserIdentifier string
URL string
Type string
// User info
Name string
Username string `gorm:"primary_key:true"`
Bio string
Avatar string
BackgroundImage string
// Profile stats
Location string
JoinDate time.Time
IsPrivate bool
IsVerified bool
// Follows
Following int
FollowingList []*TwitterUser `gorm:"many2many:twitter_followings;association_jointable_foreignkey:following_user_id"`
Followers int
FollowersList []*TwitterUser `gorm:"many2many:twitter_followers;association_jointable_foreignkey:followers_user_id"`
// Usage stats
Tweets int
Likes int
MediaCount int
}
TwitterUser holds the follow graph info, only relating userNames
func ConvertTwitterUser ¶
func ConvertTwitterUser(raw *TwitterUserRaw) *TwitterUser
ConvertTwitterUser converts the raw TwitterUser structure from kafka into the database model
type TwitterUserRaw ¶
type TwitterUserRaw struct {
// Meta
ID string `json:"id"`
URL string `json:"url"`
Type string `json:"type"`
// User info
Name string `json:"name"`
Username string `json:"username"`
Bio string `json:"bio"`
Avatar string `json:"avatar"`
BackgroundImage string `json:"background_image"`
// Profile stats
Location string `json:"location"`
JoinDate string `json:"join_date"`
JoinTime string `json:"join_time"`
IsPrivate int `json:"is_private"`
IsVerified int `json:"is_verified"`
// Follows
Following int `json:"following"`
FollowingList []string `json:"following_list"`
Followers int `json:"followers"`
FollowersList []string `json:"followers_list"`
// Usage stats
Tweets int `json:"tweets"`
Likes int `json:"likes"`
MediaCount int `json:"media_count"`
}
TwitterUserRaw holds the follow graph info, only relating userNames
Click to show internal directories.
Click to hide internal directories.