treehole

package
v0.0.0-...-b3d5dc0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotTreehole = errors.New("not a treehole")
View Source
var Template = &template{
	Post:    "{{body}}\n==========\n{{comments}}",
	Comment: "{{author}}: {{content}}\n----------",
}

Functions

func GetComments

func GetComments(id ID) (*[]Comment, error)

Types

type Comment

type Comment struct {
	ID      int
	Date    time.Time
	Author  string
	Content string
}

func (*Comment) String

func (comment *Comment) String() string

type ID

type ID uint

func LatestID

func LatestID() ID

type Neighbour

type Neighbour struct {
	Prev ID `json:"prev_id"`
	Next ID `json:"next_id"`
}

type Treehole

type Treehole struct {
	ID        ID
	Neighbour Neighbour
	Author    string
	Content   string
	Comments  *[]Comment
}

func GetFromID

func GetFromID(id ID) (*Treehole, error)

func GetFromURL

func GetFromURL(url string) (*Treehole, error)

func ParseFromHtml

func ParseFromHtml(b []byte) (*Treehole, error)

func (*Treehole) String

func (th *Treehole) String() string

Jump to

Keyboard shortcuts

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