Documentation ¶
Index ¶
- func CommonMiddleware(next http.Handler) http.Handler
- func DefaultErrorHandler(w http.ResponseWriter, status int)
- func DeletePost(j *API, path, col, id string)
- func ErrorLog(err error)
- func Handler(a *API) http.Handler
- func InterceptHandler(next http.Handler, errH ErrorHandler) http.Handler
- func ReadData(j *API, path string) [][]byte
- func ReadPost(j *API, path, col, id string) mod.Post
- func ReadPostCollection(j *API, path, col string) []mod.Post
- type API
- func (a *API) CreatePostHandler(w http.ResponseWriter, r *http.Request)
- func (j *API) Delete(collection, resource string) error
- func (j *API) DeletePostHandler(w http.ResponseWriter, r *http.Request)
- func (a *API) Host(h string) *API
- func (j *API) Read(collection, resource string, v interface{}) error
- func (j *API) ReadAll(collection string) ([]string, error)
- func (j *API) ReadPostCollectionHandler(w http.ResponseWriter, r *http.Request)
- func (j *API) ReadPostHandler(w http.ResponseWriter, r *http.Request)
- func (a *API) UpdatePost(path, col, id string, post mod.Post) error
- func (a *API) UpdatePostHandler(w http.ResponseWriter, r *http.Request)
- func (j *API) Write(collection, resource string, v interface{}) error
- type ErrorHandler
- type Logger
- type Options
- type Post
- type Posts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonMiddleware ¶
CommonMiddleware --Set content-type
func DefaultErrorHandler ¶
func DefaultErrorHandler(w http.ResponseWriter, status int)
func InterceptHandler ¶
func InterceptHandler(next http.Handler, errH ErrorHandler) http.Handler
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
Driver is what is used to interact with the scribble database. It runs transactions, and provides log output
func NewAPI ¶
New creates a new scribble database at the desired directory location, and returns a *Driver to then use for interacting with the database
func (*API) CreatePostHandler ¶
func (a *API) CreatePostHandler(w http.ResponseWriter, r *http.Request)
Create appends post path prefix for a database write
func (*API) Delete ¶
Delete locks that database and then attempts to remove the collection/resource specified by path
func (*API) DeletePostHandler ¶
func (j *API) DeletePostHandler(w http.ResponseWriter, r *http.Request)
Delete data from the database
func (*API) ReadAll ¶
ReadAll records from a collection; this is returned as a slice of strings because there is no way of knowing what type the record is.
func (*API) ReadPostCollectionHandler ¶
func (j *API) ReadPostCollectionHandler(w http.ResponseWriter, r *http.Request)
Rresponse Handler.
func (*API) ReadPostHandler ¶
func (j *API) ReadPostHandler(w http.ResponseWriter, r *http.Request)
// Response Handler
func (*API) UpdatePost ¶
Update appends post path prefix for a database write
func (*API) UpdatePostHandler ¶
func (a *API) UpdatePostHandler(w http.ResponseWriter, r *http.Request)
Update appends post path prefix for a database write
type ErrorHandler ¶
type ErrorHandler func(http.ResponseWriter, int)
type Logger ¶
type Logger interface { Fatal(string, ...interface{}) Error(string, ...interface{}) Warn(string, ...interface{}) Info(string, ...interface{}) Debug(string, ...interface{}) Trace(string, ...interface{}) }
Logger is a generic logger interface
type Options ¶
type Options struct {
Logger // the logger scribble will use (configurable)
}
Options uses for specification of working golang-scribble