forum

package
v0.0.0-...-b9c4a7d Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxDepth = 100
	Root     = "Posts"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bump

type Bump struct {
	ID     PostID
	Head   string
	Author User
	Time   time.Time `firestore:",serverTimestamp"`
}

type BumpTimeDesc

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

func (*BumpTimeDesc) Next

func (tc *BumpTimeDesc) Next(post *Post) Cursor

type Context

type Context = context.Context

type CreateTimeAsc

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

func (*CreateTimeAsc) Next

func (tc *CreateTimeAsc) Next(post *Post) Cursor

type Cursor

type Cursor interface {
	Next(post *Post) Cursor
	// contains filtered or unexported methods
}

type DeleteInfo

type DeleteInfo struct {
	When time.Time
	Who  User
	Why  string
}

type Forum

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

func NewClient

func NewClient(ctx Context, projectId string) (*Forum, error)

NewClient returns a new forum client

func (Forum) CreateDraftReply

func (f Forum) CreateDraftReply(ctx context.Context, s []string, body string, author string) (string, error)

func (Forum) CreateReply

func (f Forum) CreateReply(ctx Context, parent []PostID, subject string, body string, author User) ([]PostID, error)

func (Forum) CreateSection

func (f Forum) CreateSection(ctx Context, subject string, description string, index int, author User) ([]PostID, error)

func (Forum) CreateThread

func (f Forum) CreateThread(ctx Context, subject string, body string, author User, sectionId PostID) ([]PostID, error)

func (Forum) DeleteReply

func (f Forum) DeleteReply(ctx context.Context, path []string, s string) error

func (Forum) DeleteSection

func (f Forum) DeleteSection(ctx context.Context, sectionID string, user User, reason string) error

func (Forum) DeleteThread

func (f Forum) DeleteThread(ctx context.Context, threadID string, user User, reason string) error

func (Forum) GetReplies

func (f Forum) GetReplies(ctx Context, thread PostID, cursor Cursor, n int) ([]*Post, error)

func (Forum) GetSections

func (f Forum) GetSections(ctx Context) ([]*Post, error)

func (Forum) GetThreads

func (f Forum) GetThreads(ctx Context, section PostID, cursor Cursor, n int) ([]*Post, Cursor, error)

GetThreads retrieves threads, most-recently-bumped thread first.

func (Forum) InstallReply

func (f Forum) InstallReply(ctx context.Context, userID string, docID string) error

func (Forum) ListReplies

func (f Forum) ListReplies(ctx context.Context, threadID string) ([]*Post, error)

func (Forum) ListThreads

func (f Forum) ListThreads(ctx context.Context, sectionID string) ([]*Post, error)

func (Forum) UpdateReply

func (f Forum) UpdateReply(ctx context.Context, replyID string, body string) error

func (Forum) UpdateThread

func (f Forum) UpdateThread(ctx context.Context, threadID string, subject string, body string) error

type IndexAsc

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

func (IndexAsc) Next

func (i IndexAsc) Next(post *Post) Cursor

type Order

type Order struct {
	Field     string
	Direction firestore.Direction
}

type Post

type Post struct {
	Path            []PostID // Path to this post, from root down.
	Index           int      // For explicit ordering
	Parent          PostID   // ID of the parent of this post (same as next-to-last element of Path)
	Head            string   // Subject or summary of post
	Body            string   // Body of post (HTML)
	Author          User     // ID of author
	Bump            *Bump    // Most recent change to tree rooted here.
	ChildCount      int      // Number of direct children
	DescendentCount int      // Number of direct and indirect children
	ViewCount       int      // Number of times this post has been viewed
	Deleted         *DeleteInfo
	CreateTime      time.Time `firestore:",serverTimestamp"` // Time this post was created.
	EditTime        time.Time `firestore:",serverTimestamp"` // Last time the header or body were edited
}

func (*Post) ID

func (p *Post) ID() PostID

type PostID

type PostID = string

type User

type User struct {
	ID       string
	Name     string
	PhotoURL string
	Joined   time.Time
}

Jump to

Keyboard shortcuts

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