store

package
v0.0.0-...-3a5708c Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package store is an interface for the storage engine behind Gone.

There could be implementations for storage via file system, database, S3 etc.

Index

Constants

View Source
const (
	FallbackMimeType = "application/octet-stream"
	MarkdownMimeType = "text/markdown"
	UrlMimeType      = "text/url"
)

Variables

This section is empty.

Functions

func IsAccessDeniedError

func IsAccessDeniedError(e interface{}) bool

func IsPathNotFoundError

func IsPathNotFoundError(e interface{}) bool

Types

type AccessDeniedError

type AccessDeniedError string

func NewAccessDeniedError

func NewAccessDeniedError(msg string) AccessDeniedError

func (AccessDeniedError) Error

func (e AccessDeniedError) Error() string

type PathNotFoundError

type PathNotFoundError string

func NewPathNotFoundError

func NewPathNotFoundError(msg string) PathNotFoundError

func (PathNotFoundError) Error

func (e PathNotFoundError) Error() string

type Store

type Store interface {
	HasReadAccessForRequest(request *http.Request) bool
	HasWriteAccessForRequest(request *http.Request) bool
	HasDeleteAccessForRequest(request *http.Request) bool

	OpenReader(request *http.Request) io.ReadCloser
	OpenWriter(request *http.Request) io.WriteCloser

	ReadString(request *http.Request) string
	WriteString(request *http.Request, content string)

	Delete(request *http.Request)

	FileSizeForRequest(request *http.Request) int64
	MimeTypeForRequest(request *http.Request) string
	ModTimeForRequest(request *http.Request) time.Time

	// Err() clears and returns the error value.
	// It allows for error checking after one or more operations.
	Err() error
}

Store allows to read and write wiki contents and incorporates access control.

Elementary to use the Store interface is the Err() method. As soon as an error occurs, all functions in Store turn to no-ops. The Err() method clears the error value and allows for error checking.

Directories

Path Synopsis
Package filestore implements the storage via filesystem.
Package filestore implements the storage via filesystem.
Package mockstore contains a mocked store implementation only for testing.
Package mockstore contains a mocked store implementation only for testing.

Jump to

Keyboard shortcuts

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