twitter

package
v0.0.0-...-a453e02 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package twitter implements twitter sync task.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDao

func NewDao(ctx context.Context, addr, dbName, user, pwd string) (d *mongoDao, err error)

Types

type ClickhouseDao

type ClickhouseDao struct {
	// contains filtered or unexported fields
}

func NewSearchDao

func NewSearchDao(dsn string) (*ClickhouseDao, error)

func (*ClickhouseDao) GetLargestID

func (d *ClickhouseDao) GetLargestID() (string, error)

GetLargestID returns the largest id of tweets

do not use this API, twitter's id is not monotonical

func (*ClickhouseDao) GetLatestCreatedAt

func (d *ClickhouseDao) GetLatestCreatedAt() (time.Time, error)

func (*ClickhouseDao) SaveTweet

func (d *ClickhouseDao) SaveTweet(tweet ClickhouseTweet) error

type ClickhouseTweet

type ClickhouseTweet 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 (ClickhouseTweet) TableName

func (ClickhouseTweet) TableName() string

type ElasticsearchDao

type ElasticsearchDao struct {
	// contains filtered or unexported fields
}

func (*ElasticsearchDao) GetLargestID

func (d *ElasticsearchDao) GetLargestID(ctx context.Context) (largestID float64, err error)

func (*ElasticsearchDao) SaveTweet

func (d *ElasticsearchDao) SaveTweet(ctx context.Context, tweet *Tweet) error

type Entities

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

type Media

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

type Service

type Service struct {
	// contains filtered or unexported fields
}

type Tweet

type Tweet struct {
	MongoID primitive.ObjectID `bson:"_id,omitempty" json:"mongo_id,omitempty"`
	ID      string             `bson:"id_str" json:"id"`
	// CreatedAt       *time.Time         `bson:"created_at" json:"created_at"`
	Text string `bson:"text" json:"text"`
}

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