Documentation
¶
Index ¶
- Constants
- Variables
- func CloseContext(ctx *Context)
- func DigitsIn(n int) int
- func GenerateTSBindings(app *Application, targetFile string)
- func InitRotatingLogger(name string)
- func ModifiedRequestPath(req *http.Request, npath string) *http.Request
- func NiceStackTraceOnPanic()
- func PrintFileQuote(buf io.Writer, fq FileQuote)
- func PrintReport(report TSReport)
- func PrintStacktraceElements(buf io.Writer, trace []StackTraceElement)
- func PrintTSDiagnosticQuote(b *strings.Builder, diag Diagnostic)
- func PrintUsefulStackTrace(buf io.Writer)
- func RegisterDataProc[Input any](app *Application, proc func(*Context, Input) (ContentDownload, error))
- func RegisterProc[Input, Output any](app *Application, proc func(*Context, Input) (Output, error))
- func RegisterProcRawInput[Output any](app *Application, proc func(*Context, *http.Request) (Output, error), ...)
- func Respond(w *ResponseWriter, object interface{})
- func RespondContentDownload(w *ResponseWriter, content *ContentDownload)
- func RespondError(w http.ResponseWriter, err error)
- func RunBackServer(port int)
- func ServerTimingHeaderValue(dur time.Duration) string
- func TSWatch(dirlist []string, ch chan TSReport)
- func UseWriteTx(ctx *Context)
- func WriteProcTSBinding(p *ProcedureInfo, w io.Writer)
- type Application
- func (app *Application) HandleData(w http.ResponseWriter, request *http.Request)
- func (app *Application) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
- func (app *Application) HandleRPC(w http.ResponseWriter, request *http.Request)
- func (app *Application) HandleRoot(w http.ResponseWriter, request *http.Request)
- func (app *Application) HandleStatic(w http.ResponseWriter, request *http.Request)
- func (app *Application) ServeHTTP(wp http.ResponseWriter, request *http.Request)
- type ContentDownload
- type Context
- type DataProcInfo
- type Diagnostic
- type Empty
- type FileLine
- type FileQuote
- type ProcedureInfo
- type ResponseWriter
- type StackTraceElement
- type TSReport
Constants ¶
View Source
const PREFIX_DATA = "/data/"
View Source
const PREFIX_RPC = "/rpc/"
View Source
const PREFIX_STATIC = "/static/"
Variables ¶
View Source
var ErrorType = reflect.TypeOf((*error)(nil)).Elem()
View Source
var ProcedureNotFound = errors.New("Procedure Not Found")
Functions ¶
func CloseContext ¶
func CloseContext(ctx *Context)
func GenerateTSBindings ¶
func GenerateTSBindings(app *Application, targetFile string)
func InitRotatingLogger ¶
func InitRotatingLogger(name string)
func NiceStackTraceOnPanic ¶
func NiceStackTraceOnPanic()
func PrintFileQuote ¶
func PrintReport ¶
func PrintReport(report TSReport)
func PrintStacktraceElements ¶
func PrintStacktraceElements(buf io.Writer, trace []StackTraceElement)
func PrintTSDiagnosticQuote ¶
func PrintTSDiagnosticQuote(b *strings.Builder, diag Diagnostic)
func PrintUsefulStackTrace ¶
func RegisterDataProc ¶
func RegisterDataProc[Input any](app *Application, proc func(*Context, Input) (ContentDownload, error))
func RegisterProc ¶
func RegisterProc[Input, Output any](app *Application, proc func(*Context, Input) (Output, error))
func RegisterProcRawInput ¶
func Respond ¶
func Respond(w *ResponseWriter, object interface{})
func RespondContentDownload ¶
func RespondContentDownload(w *ResponseWriter, content *ContentDownload)
func RespondError ¶
func RespondError(w http.ResponseWriter, err error)
func RunBackServer ¶
func RunBackServer(port int)
func ServerTimingHeaderValue ¶
func UseWriteTx ¶
func UseWriteTx(ctx *Context)
func WriteProcTSBinding ¶
func WriteProcTSBinding(p *ProcedureInfo, w io.Writer)
Types ¶
type Application ¶
type Application struct { Name string Frontend fs.FS StaticData fs.FS DB *vbolt.DB *http.ServeMux // contains filtered or unexported fields }
func NewApplication ¶
func NewApplication(name string, db *vbolt.DB) *Application
NewApplication creates a new Application instance
func (*Application) HandleData ¶
func (app *Application) HandleData(w http.ResponseWriter, request *http.Request)
func (*Application) HandleFunc ¶
func (app *Application) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
func (*Application) HandleRPC ¶
func (app *Application) HandleRPC(w http.ResponseWriter, request *http.Request)
func (*Application) HandleRoot ¶
func (app *Application) HandleRoot(w http.ResponseWriter, request *http.Request)
func (*Application) HandleStatic ¶
func (app *Application) HandleStatic(w http.ResponseWriter, request *http.Request)
func (*Application) ServeHTTP ¶
func (app *Application) ServeHTTP(wp http.ResponseWriter, request *http.Request)
type ContentDownload ¶
type Context ¶
type Context struct { AppName string // because same proc can be used by multiple applications Token string *vbolt.Tx }
func MakeContext ¶
func MakeContext(app *Application, req *http.Request) (ctx Context)
type DataProcInfo ¶
data procs are called at the address bar and return downloadable content
type Diagnostic ¶
type FileQuote ¶
type ProcedureInfo ¶
type ResponseWriter ¶
type ResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
ResponseWriter helps us capture the statusCode that was written
func WrapHttpResponeWriter ¶
func WrapHttpResponeWriter(w http.ResponseWriter) *ResponseWriter
func (*ResponseWriter) WriteHeader ¶
func (w *ResponseWriter) WriteHeader(statusCode int)
type StackTraceElement ¶
func UsefulStackTrace ¶
func UsefulStackTrace() []StackTraceElement
type TSReport ¶
type TSReport struct { Time time.Time Diagnostics []Diagnostic }
Click to show internal directories.
Click to hide internal directories.