forum

package module
v0.0.0-...-e53230b Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2016 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Forum library for web applications Copyright (c) 2016 aerth import github.com/aerth/fforum MIT License

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllReplies

func AllReplies() map[string]Reply

func AllRepliesOf

func AllRepliesOf(tid string) map[string]Reply

AllRepliesOf lol

func Close

func Close()

Close safely close BoltDB

func Delete

func Delete(bucket, key string) error

func Init

func Init(location string)

func ListCategories

func ListCategories() map[string]Category

func ListTopicsAll

func ListTopicsAll() map[string]Topic

func ListTopicsOf

func ListTopicsOf(s string) map[string]Topic

func Read

func Read(bucket, key string) []byte

Read: retrieve []byte(value) of bucket[key]

func Write

func Write(bucket, key string, value []byte) error

Write: Insert data into a bucket.

Types

type Category

type Category struct {
	ID, Creator, Name string // ID is unique 32
	Topics            []string
}

Categories have a creator, Name, and a list of post IDs.

func NewCategory

func NewCategory() *Category

New category

func (Category) Delete

func (c Category) Delete() error

func (Category) Save

func (c Category) Save() error

Save lol

type Reply

type Reply struct {
	ID    string // unique 64
	To    string // Topic.ID
	Owner string // replier
	Body  string
}

func ReadReply

func ReadReply(rid string) Reply

func (Reply) Delete

func (r Reply) Delete() error

func (Reply) Save

func (r Reply) Save() error

Save lol

type Topic

type Topic struct {
	ID       string // unique 64
	Owner    string // owner id
	Title    string // owner id
	Body     string
	Category string // id 32
}

Topic knows nothing about categories. they all exist in the same bucket.

func NewTopic

func NewTopic() *Topic

New topic

func ReadTopic

func ReadTopic(id string) (*Topic, error)

Read a topic

func (Topic) Delete

func (p Topic) Delete() error

func (*Topic) NewReply

func (p *Topic) NewReply() *Reply

func (*Topic) Replies

func (p *Topic) Replies() map[string]Reply

func (Topic) Save

func (p Topic) Save() error

Save lol

Jump to

Keyboard shortcuts

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