sesame

package module
v0.0.0-...-a5aa5c2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 4 Imported by: 4

README

Sesame

A successor to Wok. But with go v1.22 support

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

Functions

func RegisterMiddleware

func RegisterMiddleware(h Handler)

Types

type Context

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

func (*Context) DB

func (c *Context) DB() (*sql.DB, error)

func (*Context) Request

func (c *Context) Request() *http.Request

func (*Context) Response

func (c *Context) Response() http.ResponseWriter

type DBOpts

type DBOpts struct {
	User, Password, Host, Dbname string
	Port                         int
}

type Handler

type Handler func(Context) error

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(wr http.ResponseWriter, r *http.Request)

Make Handler a http.Handler interface to satisfy directly passing handlers in to mux and for httptest

type Router

type Router struct {
	TLS
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter() *Router

func (*Router) Get

func (r *Router) Get(path string, h Handler)

func (*Router) Options

func (r *Router) Options(path string, h Handler)

func (*Router) Patch

func (r *Router) Patch(path string, h Handler)

func (*Router) Post

func (r *Router) Post(path string, h Handler)

func (*Router) Put

func (r *Router) Put(path string, h Handler)

func (*Router) SetDB

func (r *Router) SetDB(f func() *sql.DB)

func (*Router) StartServer

func (r *Router) StartServer(addr string)

func (*Router) StartServerTLS

func (r *Router) StartServerTLS(addr string)

type TLS

type TLS struct {
	CertFile string
	KeyFile  string
}

Jump to

Keyboard shortcuts

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