dyd

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	Bind(url string, handler func(ctx *Context, write func(s string, args ...any) error))
	ListenAndServe(addr string) error
}

App represents a dyd web app.

func NewApp

func NewApp() (App, error)

NewApp returns a newly created App or an error, if any.

type Context

type Context struct {
	ReqSequence    int64
	Request        *http.Request
	ResponseWriter http.ResponseWriter
	// contains filtered or unexported fields
}

Context provides access to the state of the server/session/request/database etc. Every web request gets a new Context instance which is automatically destroyed when the serving function returns.

Context is not safe for concurrent use by multiple goroutines.

At the moment Context provides only elementary context for the proof of concept.

func (*Context) DBConn added in v0.0.11

func (c *Context) DBConn(ctx context.Context) (*sql.Conn, error)

DBConn returns a new *sql.Conn or an error, if any. All connections are automatically closed when the serving function returns.

Jump to

Keyboard shortcuts

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