model

package
v0.0.0-...-60a6317 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSitesAsStrings

func AllSitesAsStrings() []string

Types

type Author

type Author struct {
	Name string
}

type ContinueFrom

type ContinueFrom struct {
	Key   string
	Depth int
}

type Post

type Post struct {
	ID      string
	Depth   int
	Author  Author
	Message string

	Upvotes   *int
	Downvotes *int
	CreatedAt *time.Time

	Stub *Stub
}

type Posts

type Posts []Post

func (Posts) AppendAt

func (posts Posts) AppendAt(newPosts Posts, index int) Posts

func (Posts) RemoveAt

func (posts Posts) RemoveAt(index int) Posts

func (Posts) SortByDepth

func (posts Posts) SortByDepth()

type Site

type Site interface {
	GetInput(url *url.URL, v ...string) (*SiteInput, error)
	Fetch(fi SiteInput) (Posts, error)
}

type SiteInput

type SiteInput struct {
	SiteName     SiteName
	ID           string
	Category     string
	FullUrl      *url.URL
	ContinueFrom *ContinueFrom
	ApiKey       string
}

type SiteName

type SiteName string
const (
	SiteDemo SiteName = "demo"

	SiteDisqus      SiteName = "disqus"
	SiteReddit      SiteName = "reddit"
	SiteVbulletin   SiteName = "vbulletin"
	SiteYcombinator SiteName = "ycombinator" // Hacker News
	SiteYoutube     SiteName = "youtube"
)

func AllSites

func AllSites() []SiteName

type Stub

type Stub struct {
	Count int
	Key   string
}

type Thread

type Thread struct {
	Posts Posts
}

type Threads

type Threads []Thread

func PostsToThreads

func PostsToThreads(posts Posts) Threads

func (Threads) FindPost

func (threads Threads) FindPost(postID string) (int, int)

func (Threads) FindPostsContaining

func (threads Threads) FindPostsContaining(s string) Posts

Jump to

Keyboard shortcuts

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