jsondump

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHandler

func CreateHandler(db *Db, opts appkit.Options) http.Handler

func StartWeb

func StartWeb(db *Db, opts appkit.Options) error

Types

type CodeResponseWriter

type CodeResponseWriter struct {
	http.ResponseWriter
	Code int
	Len  int
}

func (*CodeResponseWriter) Write

func (w *CodeResponseWriter) Write(b []byte) (int, error)

func (*CodeResponseWriter) WriteHeader

func (w *CodeResponseWriter) WriteHeader(code int)

type Content

type Content struct {
	Path string
	Id   int
	Text string
	Date time.Time
}

type Db

type Db struct {
	MaxVersions     int
	ReplaceInterval time.Duration
	// contains filtered or unexported fields
}

func CreateDb

func CreateDb(path string, ctx context.Context) (*Db, error)

func (*Db) Add

func (db *Db) Add(path, content string) error

func (*Db) Close

func (db *Db) Close() error

func (*Db) Delete

func (db *Db) Delete(path string) error

func (*Db) GetContent

func (db *Db) GetContent(path string, numLatest int) ([]Content, error)

func (*Db) GetPaths

func (db *Db) GetPaths() ([]string, error)

type RestApi

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

func (*RestApi) ServeHTTP

func (ra *RestApi) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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