Documentation ¶
Index ¶
- func AutoMigrateXSearchRecords(db *gorm.DB) error
- func SaveXSearchRecords(db *gorm.DB, records []XSearchRecord) error
- func SelectTweetForEngagement(db *gorm.DB, aiClient *nineteen.Client) (*XSearchRecord, *TweetSelectionResponse, error)
- type JSONB
- type TweetSelectionResponse
- type Video
- type XSearchRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoMigrateXSearchRecords ¶
AutoMigrateXSearchRecords creates or updates the necessary database tables for X search records
func SaveXSearchRecords ¶
func SaveXSearchRecords(db *gorm.DB, records []XSearchRecord) error
SaveXSearchRecords saves the prepared X search records to the database
func SelectTweetForEngagement ¶ added in v0.0.5
func SelectTweetForEngagement(db *gorm.DB, aiClient *nineteen.Client) (*XSearchRecord, *TweetSelectionResponse, error)
Types ¶
type JSONB ¶
type JSONB map[string]interface{}
JSONB represents a PostgreSQL JSONB column
type TweetSelectionResponse ¶ added in v0.0.5
type TweetSelectionResponse struct { SelectedTweetID string `json:"selected_tweet_id"` SelectedTweetText string `json:"selected_tweet_text"` SelectedTweetAuthor string `json:"selected_tweet_author"` Reason string `json:"reason"` SuggestedReplyTone string `json:"suggested_reply_tone"` }
func (*TweetSelectionResponse) UnmarshalJSON ¶ added in v0.0.5
func (t *TweetSelectionResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom unmarshaling for TweetSelectionResponse
type Video ¶
type Video struct { ID string `json:"ID"` HLSURL string `json:"HLSURL"` Preview string `json:"Preview"` URL string `json:"URL"` }
Video represents a video attachment in a tweet
type XSearchRecord ¶
type XSearchRecord struct { gorm.Model SearchID string `gorm:"index;not null"` // ID of the scheduled search Query string `gorm:"not null"` // Search query used TweetID string `gorm:"uniqueIndex;not null"` // Unique ID of the tweet UserID string `gorm:"index;not null"` // X user ID who posted Username string `gorm:"index;not null"` // X username who posted Name string `gorm:"not null"` // Display name of the user Text string `gorm:"type:text;not null"` // Tweet content HTML string `gorm:"type:text"` // HTML formatted content PostedAt time.Time `gorm:"index;not null"` // When tweet was posted PermanentURL string `gorm:"not null"` // Permanent link to tweet ConversationID string `gorm:"index"` // ID of the conversation thread InReplyToID string `gorm:"index"` // ID of tweet being replied to IsReply bool `gorm:"not null;default:false"` // Whether tweet is a reply IsRetweet bool `gorm:"not null;default:false"` // Whether tweet is a retweet IsQuoted bool `gorm:"not null;default:false"` // Whether tweet is a quote IsSelfThread bool `gorm:"not null;default:false"` // Whether part of self thread IsPin bool `gorm:"not null;default:false"` // Whether tweet is pinned IsSensitive bool `gorm:"not null;default:false"` // Whether content is sensitive LikeCount int `gorm:"not null;default:0"` // Number of likes RetweetCount int `gorm:"not null;default:0"` // Number of retweets ReplyCount int `gorm:"not null;default:0"` // Number of replies ViewCount int `gorm:"not null;default:0"` // Number of views URLs pq.StringArray `gorm:"type:text[]"` // Array of URLs in tweet PhotoURLs pq.StringArray `gorm:"type:text[]"` // Array of photo URLs VideoURLs pq.StringArray `gorm:"type:text[]"` // Array of video URLs VideoHLSURLs pq.StringArray `gorm:"type:text[]"` // Array of HLS video URLs VideoPreviews pq.StringArray `gorm:"type:text[]"` // Array of video preview URLs GifURLs pq.StringArray `gorm:"type:text[]"` // Array of GIF URLs Mentions JSONB `gorm:"type:jsonb"` // Full mention data including IDs and names Place JSONB `gorm:"type:jsonb"` // Place data if available QuotedTweetID string `gorm:"index"` // ID of quoted tweet RetweetedID string `gorm:"index"` // ID of retweeted tweet ThreadID string `gorm:"index"` // ID of thread if part of one Cycle int `gorm:"not null"` // Search cycle number SearchedAt time.Time `gorm:"index;not null"` // When search was executed }
XSearchRecord represents a database record of an X (Twitter) search result from scheduled searches
func PrepareXSearchRecords ¶
func PrepareXSearchRecords(responses []interface{}, searchID string, query string) ([]XSearchRecord, error)
PrepareXSearchRecords converts scheduler search responses into database records
Click to show internal directories.
Click to hide internal directories.