Documentation
¶
Overview ¶
Package model holds the shared type definitions used by the code block evaluation pipeline: the Evaluator interface together with its request and result types, and the HTTP DTOs exchanged with the frontend.
Index ¶
Constants ¶
const ( ContentTypeHTML = "text/html" ContentTypeText = "text/plain" ContentTypeJSON = "application/json" )
Common content types returned by evaluators.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EvalRequest ¶
type EvalRequest struct {
Language string `json:"language"`
Entry string `json:"entry,omitempty"`
Files map[string]string `json:"files"`
}
EvalRequest is the JSON request body for POST /api/codeblock/eval.
Language selects the evaluator (for example "php", "vuego", "exec", "sql"). Entry optionally overrides the default entry filename for the language. Files maps filename to content; for a single code fence this is usually a single entry, while @file references contribute additional companion files.
type EvalResponse ¶
type EvalResponse struct {
ContentType string `json:"contentType,omitempty"`
Content string `json:"content,omitempty"`
Error string `json:"error,omitempty"`
}
EvalResponse is the JSON response body for POST /api/codeblock/eval.
type Evaluator ¶
Evaluator evaluates a code snippet built on top of an fs.FS. Implementations live in the internal/php, internal/vuego, internal/exec and internal/sqlite packages.
type Request ¶
type Request struct {
// FS holds all files available to the evaluation.
FS fs.FS
// Entry is the file within FS that should be evaluated.
Entry string
}
Request is the input to an Evaluator. The caller is responsible for constructing an fs.FS containing every file required for the run and for nominating the entry point to evaluate (for example "index.php").