Back to godoc.org

Package backend

v0.1.0-dev-7770...-5e3053e
Latest Go to latest

The highest tagged major version is .

Published: Feb 27, 2019 | License: MIT | Module: github.com/bluemir/wikinote

Index

Constants

const (
	// pre-defined role
	RoleAdmin  auth.Role = "admin"
	RoleEditor auth.Role = "editor"
	RoleViewer auth.Role = "editor"
	RoleGuest  auth.Role = "guest"
	// pre-defined action
	ActionView auth.Action = "view"
	ActionEdit auth.Action = "edit"
)

func RandomString

func RandomString(n int) string

type Backend

type Backend interface {
	Config() *config.Config
	SaveConfig(conf *config.Config) error

	File() FileClause
	Auth() auth.Manager
	Plugin() PluginClause

	// renderer
	Render(data []byte) ([]byte, error)

	Close()
}

func New

func New(o *Options) (Backend, error)

type FileClause

type FileClause interface {
	Read(path string) ([]byte, error)
	Write(path string, data []byte) error
	List(path string) ([]os.FileInfo, error)
	Search(query string) (interface{}, error)

	Attr(path string) fileattr.PathClause
	AttrStore() fileattr.Store

	GetFullPath(path string) string
}

type Options

type Options struct {
	Wikipath   string
	ConfigFile string
	Version    string
}

type PluginClause

type PluginClause interface {
	Footer(path string) []PluginResult
	PreSave(path string, data []byte) ([]byte, error)
	PostSave(path string, data []byte) error
	OnRead(path string, data []byte) ([]byte, error)
	TryRead(path string, user interface{}) error
	TryWrite(path string, user interface{}) error
	RegisterRouter(r gin.IRouter)
}

type PluginResult

type PluginResult struct {
	Data template.HTML
	Err  error
}

type SearchResult

type SearchResult struct {
	Line int
	Text string
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier