model

package
v0.0.0-...-8f28ad5 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package model of twitter

Index

Constants

This section is empty.

Variables

View Source
var (
	TwitterDB mongo.DB
)

Functions

func Initialize

func Initialize(ctx context.Context)

Types

type EmbededTweet

type EmbededTweet struct {
	MongoID         primitive.ObjectID `bson:"_id,omitempty" json:"mongo_id"`
	ID              string             `bson:"id_str" json:"id"`
	CreatedAt       string             `bson:"created_at" json:"created_at"`
	Text            string             `bson:"full_text" json:"text"`
	Topics          []string           `bson:"topics" json:"topics"`
	User            *User              `bson:"user" json:"user"`
	ReplyToStatusID string             `bson:"in_reply_to_status_id_str" json:"in_reply_to_status_id"`
	Entities        *Entities          `bson:"entities" json:"entities"`
	IsRetweeted     bool               `bson:"retweeted" json:"is_retweeted"`
	RetweetedTweet  *EmbededTweet      `bson:"retweeted_status,omitempty" json:"retweeted_tweet"`
	IsQuoted        bool               `bson:"is_quote_status" json:"is_quote_status"`
	QuotedTweet     *EmbededTweet      `bson:"quoted_status,omitempty" json:"quoted_status"`
	Viewer          []int64            `bson:"viewer,omitempty" json:"viewer"`
}

func (*EmbededTweet) ToTweet

func (t *EmbededTweet) ToTweet() (tweet *Tweet, err error)

type Entities

type Entities struct {
	Media []*Media `bson:"media" json:"media"`
}

type Media

type Media struct {
	URL string `bson:"media_url_https" json:"media_url_https"`
}

type SearchTweet

type SearchTweet struct {
	TweetID   string     `gorm:"column:tweet_id" json:"tweet_id"`
	Text      string     `gorm:"column:text" json:"text"`
	UserID    string     `gorm:"column:user_id" json:"user_id"`
	CreatedAt *time.Time `gorm:"column:created_at" json:"created_at"`
}

func (SearchTweet) TableName

func (SearchTweet) TableName() string

type Tweet

type Tweet struct {
	MongoID         primitive.ObjectID `bson:"_id,omitempty" json:"mongo_id"`
	ID              string             `bson:"id_str" json:"id"`
	CreatedAt       time.Time          `bson:"created_at" json:"created_at"`
	Text            string             `bson:"text" json:"text"`
	Topics          []string           `bson:"topics" json:"topics"`
	User            *User              `bson:"user" json:"user"`
	ReplyToStatusID string             `bson:"in_reply_to_status_id_str" json:"in_reply_to_status_id"`
	Entities        *Entities          `bson:"entities" json:"entities"`
	IsRetweeted     bool               `bson:"retweeted" json:"is_retweeted"`
	RetweetedTweet  *EmbededTweet      `bson:"retweeted_status,omitempty" json:"retweeted_tweet"`
	IsQuoted        bool               `bson:"is_quote_status" json:"is_quote_status"`
	QuotedTweet     *EmbededTweet      `bson:"quoted_status,omitempty" json:"quoted_status"`
	Viewer          []int64            `bson:"viewer,omitempty" json:"viewer"`
}

type User

type User struct {
	ID         string `bson:"id_str" json:"id"`
	ScreenName string `bson:"screen_name" json:"screen_name"`
	Name       string `bson:"name" json:"name"`
	Dscription string `bson:"dscription" json:"dscription"`
}

Jump to

Keyboard shortcuts

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