core

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MarkBegin = ""
	MarkEnd   = "eof"
)

Variables

View Source
var (
	ErrNotExist = os.ErrNotExist
)

Functions

This section is empty.

Types

type Article

type Article struct {
	ArticleEntry
	Content string // in markdown
}

type ArticleEntry

type ArticleEntry struct {
	ID    string
	Title string
	Ctime time.Time
	Mtime time.Time
}

type Community

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

func New

func New(ctx context.Context, conf *Config) (ret *Community, err error)

func (*Community) Article

func (p *Community) Article(ctx context.Context, id string) (article *Article, err error)

Article returns an article.

func (*Community) CanEditable

func (p *Community) CanEditable(ctx context.Context, uid, id string) (editable bool, err error)

CanEditable

func (*Community) DeleteArticle

func (p *Community) DeleteArticle(ctx context.Context, uid, id string) (err error)

func (*Community) DeleteMedia

func (p *Community) DeleteMedia(ctx context.Context, uid, id string) (err error)

func (*Community) ListArticle

func (p *Community) ListArticle(ctx context.Context, from string, limit int) (items []*ArticleEntry, next string, err error)

ListArticle lists articles from an position.

func (*Community) MediaURL

func (p *Community) MediaURL(id string) (url string)

func (*Community) PutArticle

func (p *Community) PutArticle(ctx context.Context, uid string, article *Article) (id string, err error)

PutArticle adds new article (ID == "") or edits an existing article (ID != "").

func (*Community) PutMedia

func (p *Community) PutMedia(ctx context.Context, uid string, media []byte) (id string, err error)

PutMedia uploads media.

type Config

type Config struct {
	Driver string // database driver. default is `mysql`.
	DSN    string // database data source name
	BlobUS string // blob URL scheme
}

Jump to

Keyboard shortcuts

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