search

package
v0.0.0-...-1eb5c16 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReplyRelationship = "r"
	QuoteRelationship = "q"
	PositiveSentiment = "p"
	NegativeSentiment = "n"
	NeutralSentiment  = "u"
)

Post relationships

Variables

View Source
var PostsNotFound = fmt.Errorf("posts not found")

Functions

This section is empty.

Types

type Author

type Author struct {
	DID           string `json:"did"`
	Handle        string `json:"handle"`
	ClusterOptOut bool   `json:"cluster_opt_out"`
}

type AuthorBlock

type AuthorBlock struct {
	ActorDID  string    `json:"author_did"`
	TargetDID string    `json:"target_did"`
	CreatedAt time.Time `json:"created_at"`
}

type AuthorStats

type AuthorStats struct {
	TotalAuthors  int64        `json:"total_authors"`
	TotalPosts    int64        `json:"total_posts"`
	MeanPostCount float64      `json:"mean_post_count"`
	Percentiles   []Percentile `json:"percentiles"`
	Brackets      []Bracket    `json:"brackets"`
	UpdatedAt     time.Time    `json:"updated_at"`
}

type Bracket

type Bracket struct {
	Min   int   `json:"min"`
	Count int64 `json:"count"`
}

type Cluster

type Cluster struct {
	ID          int32  `json:"id"`
	LookupAlias string `json:"lookup_alias"`
	Name        string `json:"name"`
}

type Image

type Image struct {
	CID         string           `json:"cid"`
	PostID      string           `json:"post_id"`
	AuthorDID   string           `json:"author_did"`
	AltText     *string          `json:"alt_text"`
	MimeType    string           `json:"mime_type"`
	CreatedAt   time.Time        `json:"created_at"`
	CVCompleted bool             `json:"cv_completed"`
	CVRunAt     *time.Time       `json:"cv_run_at"`
	CVClasses   *json.RawMessage `json:"cv_classes"`
}

type Label

type Label struct {
	ID          string `json:"id"`
	LookupAlias string `json:"lookup_alias"`
	Name        string `json:"name"`
}

type NotFoundError

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

type Percentile

type Percentile struct {
	Percentile float64 `json:"percentile"`
	Count      int64   `json:"count"`
}

type Post

type Post struct {
	ID                  string     `json:"id"`
	Text                string     `json:"text"`
	ParentPostID        *string    `json:"parent_post_id"`
	RootPostID          *string    `json:"root_post_id"`
	AuthorDID           string     `json:"author_did"`
	AuthorHandle        *string    `json:"author_handle"`
	CreatedAt           time.Time  `json:"created_at"`
	HasEmbeddedMedia    bool       `json:"has_embedded_media"`
	ParentRelationship  *string    `json:"parent_relationship"` // null, "r", "q"
	Sentiment           *string    `json:"sentiment"`
	SentimentConfidence *float64   `json:"sentiment_confidence"`
	Images              []*Image   `json:"images,omitempty"`
	Hotness             *float64   `json:"hotness,omitempty"`
	Labels              []string   `json:"labels,omitempty"`
	IndexedAt           *time.Time `json:"indexed_at,omitempty"`
}

type PostRegistry

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

func NewPostRegistry

func NewPostRegistry(connectionString string) (*PostRegistry, error)

func (*PostRegistry) AddAuthor

func (pr *PostRegistry) AddAuthor(ctx context.Context, author *Author) error

func (*PostRegistry) AddAuthorBlock

func (pr *PostRegistry) AddAuthorBlock(ctx context.Context, authorDID string, targetDID string, createdAt time.Time) error

func (*PostRegistry) AddCVDataToImage

func (pr *PostRegistry) AddCVDataToImage(ctx context.Context, cid string, postID string, cvRunAt time.Time, cvClasses json.RawMessage) error

func (*PostRegistry) AddImage

func (pr *PostRegistry) AddImage(ctx context.Context, image *Image) error

func (*PostRegistry) AddLikeToPost

func (pr *PostRegistry) AddLikeToPost(ctx context.Context, postID string, authorDid string) error

func (*PostRegistry) AddOneLabelPerPost

func (pr *PostRegistry) AddOneLabelPerPost(ctx context.Context, labels []string, postIDs []string, authorDIDs []string) error

func (*PostRegistry) AddPost

func (pr *PostRegistry) AddPost(ctx context.Context, post *Post) error

func (*PostRegistry) AddPostLabel

func (pr *PostRegistry) AddPostLabel(ctx context.Context, postID string, authorDid string, label string) error

func (*PostRegistry) AssignAuthorToCluster

func (pr *PostRegistry) AssignAuthorToCluster(ctx context.Context, authorDID string, clusterID int32) error

func (*PostRegistry) AssignLabelToAuthorByAlias

func (pr *PostRegistry) AssignLabelToAuthorByAlias(ctx context.Context, authorDID string, labelAlias string) error

func (*PostRegistry) Close

func (pr *PostRegistry) Close() error

func (*PostRegistry) CreateLabel

func (pr *PostRegistry) CreateLabel(ctx context.Context, labelAlias string, labelName string) (*Label, error)

func (*PostRegistry) GetAllLabels

func (pr *PostRegistry) GetAllLabels(ctx context.Context, limit int32, offset int32) ([]Label, error)

func (*PostRegistry) GetAllTimeBangers

func (pr *PostRegistry) GetAllTimeBangers(ctx context.Context, limit int32, offset int32) ([]*Post, error)

func (*PostRegistry) GetAuthor

func (pr *PostRegistry) GetAuthor(ctx context.Context, did string) (*Author, error)

func (*PostRegistry) GetAuthorStats

func (pr *PostRegistry) GetAuthorStats(ctx context.Context) (*AuthorStats, error)

func (*PostRegistry) GetAuthorsByHandle

func (pr *PostRegistry) GetAuthorsByHandle(ctx context.Context, handle string) ([]*Author, error)

func (*PostRegistry) GetBangerPostsForAuthor

func (pr *PostRegistry) GetBangerPostsForAuthor(ctx context.Context, did string, limit int32, offset int32) ([]*Post, error)

func (*PostRegistry) GetBlockedByCount

func (pr *PostRegistry) GetBlockedByCount(ctx context.Context, targetDID string) (int64, error)

func (*PostRegistry) GetBlocksPageForTarget

func (pr *PostRegistry) GetBlocksPageForTarget(ctx context.Context, targetDID string, limit int32, offset int32) ([]*AuthorBlock, error)

func (*PostRegistry) GetClusters

func (pr *PostRegistry) GetClusters(ctx context.Context) ([]*Cluster, error)

func (*PostRegistry) GetImage

func (pr *PostRegistry) GetImage(ctx context.Context, imageCID string, postID string) (*Image, error)

func (*PostRegistry) GetImagesForPost

func (pr *PostRegistry) GetImagesForPost(ctx context.Context, postID string) ([]*Image, error)

func (*PostRegistry) GetLabelPage

func (pr *PostRegistry) GetLabelPage(ctx context.Context, limit int32, offset int32) ([]*Label, error)

func (*PostRegistry) GetLabelsForAuthor

func (pr *PostRegistry) GetLabelsForAuthor(ctx context.Context, authorDID string) ([]*Label, error)

func (*PostRegistry) GetMembersOfAuthorLabel

func (pr *PostRegistry) GetMembersOfAuthorLabel(ctx context.Context, labelAlias string) ([]*Author, error)

func (*PostRegistry) GetOldestPresentParent

func (pr *PostRegistry) GetOldestPresentParent(ctx context.Context, postID string) (*Post, error)

func (*PostRegistry) GetOptedOutAuthors

func (pr *PostRegistry) GetOptedOutAuthors(ctx context.Context) ([]*Author, error)

func (*PostRegistry) GetPost

func (pr *PostRegistry) GetPost(ctx context.Context, postID string) (*Post, error)

func (*PostRegistry) GetPostPage

func (pr *PostRegistry) GetPostPage(ctx context.Context, limit int32, offset int32) ([]Post, error)

func (*PostRegistry) GetPostPageCursor

func (pr *PostRegistry) GetPostPageCursor(ctx context.Context, limit int32, cursor time.Time) ([]*Post, error)

func (*PostRegistry) GetPostWithAuthorHandle

func (pr *PostRegistry) GetPostWithAuthorHandle(ctx context.Context, postID string) (*Post, error)

func (*PostRegistry) GetPostsPageForAuthorLabel

func (pr *PostRegistry) GetPostsPageForAuthorLabel(
	ctx context.Context,
	authorLabel string,
	hoursAgo int32,
	limit int32,
	cursor string,
	includeReplies bool,
) ([]*Post, error)

func (*PostRegistry) GetPostsPageForAuthorLabelFromView

func (pr *PostRegistry) GetPostsPageForAuthorLabelFromView(
	ctx context.Context,
	authorLabel string,
	hoursAgo int32,
	limit int32,
	cursor string,
	includeReplies bool,
) ([]*Post, error)

func (*PostRegistry) GetPostsPageForCluster

func (pr *PostRegistry) GetPostsPageForCluster(
	ctx context.Context,
	clusterAlias string,
	hoursAgo int32,
	limit int32,
	cursor time.Time,
) ([]*Post, error)

func (*PostRegistry) GetPostsPageForPostLabel

func (pr *PostRegistry) GetPostsPageForPostLabel(
	ctx context.Context,
	postLabel string,
	hoursAgo int32,
	limit int32,
	cursor string,
) ([]*Post, error)

func (*PostRegistry) GetPostsPageForPostLabelByHotness

func (pr *PostRegistry) GetPostsPageForPostLabelByHotness(
	ctx context.Context,
	postLabel string,
	limit int32,
	cursor float64,
) ([]*Post, error)

func (*PostRegistry) GetPostsPageForPostLabelChronological

func (pr *PostRegistry) GetPostsPageForPostLabelChronological(
	ctx context.Context,
	postLabel string,
	limit int32,
	cursor time.Time,
) ([]*Post, error)

func (*PostRegistry) GetPostsPageForPostLabelsByHotness

func (pr *PostRegistry) GetPostsPageForPostLabelsByHotness(
	ctx context.Context,
	postLabels []string,
	limit int32,
	cursor float64,
) ([]*Post, error)

func (*PostRegistry) GetPostsPageFromViewForCluster

func (pr *PostRegistry) GetPostsPageFromViewForCluster(
	ctx context.Context,
	clusterAlias string,
	hoursAgo int32,
	limit int32,
	cursor time.Time,
) ([]*Post, error)

func (*PostRegistry) GetThreadView

func (pr *PostRegistry) GetThreadView(ctx context.Context, postID, authorID string) ([]PostView, error)

func (*PostRegistry) GetUnindexedPostPage

func (pr *PostRegistry) GetUnindexedPostPage(ctx context.Context, limit int32, offset int32) ([]*Post, error)

func (*PostRegistry) GetUniquePostLabels

func (pr *PostRegistry) GetUniquePostLabels(ctx context.Context) ([]string, error)

func (*PostRegistry) GetUnprocessedImages

func (pr *PostRegistry) GetUnprocessedImages(ctx context.Context, limit int32) ([]*Image, error)

func (*PostRegistry) RemoveBlock

func (pr *PostRegistry) RemoveBlock(ctx context.Context, actorDID string, targetDID string) error

func (*PostRegistry) RemoveLikeFromPost

func (pr *PostRegistry) RemoveLikeFromPost(ctx context.Context, postID string) error

func (*PostRegistry) SetIndexedAtTimestamp

func (pr *PostRegistry) SetIndexedAtTimestamp(ctx context.Context, postIDs []string, indexedAt time.Time) error

func (*PostRegistry) SetSentimentResults

func (pr *PostRegistry) SetSentimentResults(ctx context.Context, posts []*sentiment.SentimentPost) []error

func (*PostRegistry) UnassignLabelFromAuthorByAlias

func (pr *PostRegistry) UnassignLabelFromAuthorByAlias(ctx context.Context, authorDID string, labelAlias string) error

func (*PostRegistry) UpdateAuthorOptOut

func (pr *PostRegistry) UpdateAuthorOptOut(ctx context.Context, did string, optOut bool) error

type PostView

type PostView struct {
	Post         `json:"post"`
	AuthorHandle string `json:"author_handle"`
	Depth        int    `json:"depth"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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