Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

boards source realm

Constants 1

Functions 9

func DeletePost

crossing Action
1func DeletePost(cur realm, bid BoardID, threadid, postid PostID, reason string)
source

func EditPost

crossing Action
1func EditPost(cur realm, bid BoardID, threadid, postid PostID, title, body string)
source

func CreateReply

crossing Action
1func CreateReply(cur realm, bid BoardID, threadid, postid PostID, body string) PostID
source

func CreateRepost

crossing Action
1func CreateRepost(cur realm, bid BoardID, postid PostID, title string, body string, dstBoardID BoardID) PostID
source

If dstBoard is private, does not ping back. If board specified by bid is private, panics.

Types 5

type Board

struct
 1type Board struct {
 2	id        BoardID // only set for public boards.
 3	url       string
 4	name      string
 5	creator   address
 6	threads   avl.Tree // Post.id -> *Post
 7	postsCtr  uint64   // increments Post.id
 8	createdAt time.Time
 9	deleted   avl.Tree // TODO reserved for fast-delete.
10}
source

Methods on Board

func AddThread

method on Board
1func (board *Board) AddThread(creator address, title string, body string) *Post
source

func DeleteThread

method on Board
1func (board *Board) DeleteThread(pid PostID)
source

NOTE: this can be potentially very expensive for threads with many replies. TODO: implement optional fast-delete where thread is simply moved.

func GetThread

method on Board
1func (board *Board) GetThread(pid PostID) *Post
source

func HasPermission

method on Board
1func (board *Board) HasPermission(addr address, perm Permission) bool
source

func IsPrivate

method on Board
1func (board *Board) IsPrivate() bool
source

func RenderBoard

method on Board
1func (board *Board) RenderBoard() string
source

Renders the board for display suitable as plaintext in console. This is suitable for demonstration or tests, but not for prod.

type BoardID

ident
1type BoardID uint64
source

Methods on BoardID

func String

method on BoardID
1func (bid BoardID) String() string
source

type Post

struct
 1type Post struct {
 2	board       *Board
 3	id          PostID
 4	creator     address
 5	title       string // optional
 6	body        string
 7	replies     avl.Tree // Post.id -> *Post
 8	repliesAll  avl.Tree // Post.id -> *Post (all replies, for top-level posts)
 9	reposts     avl.Tree // Board.id -> Post.id
10	threadID    PostID   // original Post.id
11	parentID    PostID   // parent Post.id (if reply or repost)
12	repostBoard BoardID  // original Board.id (if repost)
13	createdAt   time.Time
14	updatedAt   time.Time
15}
source

A Post is a "thread" or a "reply" depending on context. A thread is a Post of a Board that holds other replies.

Methods on Post

func AddReply

method on Post
1func (post *Post) AddReply(creator address, body string) *Post
source

func AddRepostTo

method on Post
1func (post *Post) AddRepostTo(creator address, title, body string, dst *Board) *Post
source

func DeletePost

method on Post
1func (thread *Post) DeletePost(pid PostID)
source

func GetPostID

method on Post
1func (post *Post) GetPostID() PostID
source

func GetReply

method on Post
1func (thread *Post) GetReply(pid PostID) *Post
source

func GetURL

method on Post
1func (post *Post) GetURL() string
source

func HasPermission

method on Post
1func (post *Post) HasPermission(addr address, perm Permission) bool
source

func IsThread

method on Post
1func (post *Post) IsThread() bool
source

func RenderInner

method on Post
1func (post *Post) RenderInner() string
source

render reply and link to context thread

func RenderPost

method on Post
1func (post *Post) RenderPost(indent string, levels int) string
source

func Update

method on Post
1func (post *Post) Update(title string, body string)
source

type PostID

ident
1type PostID uint64
source

NOTE: a PostID is relative to the board.

Methods on PostID

func String

method on PostID
1func (pid PostID) String() string
source

Imports 9

Source Files 9