storage

package
v0.0.0-...-24a8c69 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidUser = errors.New("invalid user")

ErrInvalidUser represents invalid user error.

Functions

This section is empty.

Types

type Tweet

type Tweet struct {
	Source      string    `json:"source" bson:"source" example:"Twitter Web Client"`
	ID          string    `json:"id" bson:"id" example:"4629116949"`
	Text        string    `json:"text" bson:"text" example:"- Read what Donald Trump has to say about daughter ..."`
	CreateTime  time.Time `json:"create_time" bson:"create_time" example:"2009-10-05T14:37:38.000Z"`
	Retweets    int64     `json:"retweets" bson:"retweets" example:"1"`
	ReplyUserID *string   `json:"reply_user_id" bson:"reply_user_id" example:"996852" extensions:"x-nullable"`
	Favorites   int64     `json:"favorites" bson:"favorites" example:"4"`
	IsRetweet   bool      `json:"is_retweet" bson:"is_retweet" example:"false"`
}

Tweet represents a tweet.

func (*Tweet) MarshalLogObject

func (twt *Tweet) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject marshals tweet.

type Tweets

type Tweets []*Tweet

Tweets represents a list of tweets.

func (Tweets) MarshalLogArray

func (twts Tweets) MarshalLogArray(enc zapcore.ArrayEncoder) error

func (Tweets) SortByDate

func (twts Tweets) SortByDate()

SortByDate sorts tweets by date.

func (Tweets) SortByFavorites

func (twts Tweets) SortByFavorites()

SortByFavorites sorts tweets by favorites count.

func (Tweets) SortByRetweets

func (twts Tweets) SortByRetweets()

SortByRetweets sorts tweets by retweets count.

type TweetsOptions

type TweetsOptions struct {
	AfterTime   *time.Time
	BeforeTime  *time.Time
	IsRetweet   *bool
	ReplyUserID *string
}

TweetsOptions represents the criteria to get the tweets.

type Twitter

type Twitter interface {
	AddTweets(ctx context.Context, user string, tweets Tweets) error
	Tweets(ctx context.Context, user string, opts TweetsOptions) (Tweets, error)

	Close(ctx context.Context)
}

Twitter represents storage for tweets.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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