Documentation
¶
Index ¶
- Constants
- Variables
- func AllNSes() map[string]*vm.Namespace
- func DefNSBare(name string) *vm.Namespace
- func DumpNamespaces(fileName string)
- func EDNEncodeArgs(args []vm.Value) (string, error)
- func FuzzyNamespacedSymbolLookup(currentNS *vm.Namespace, s vm.Symbol) []vm.Symbol
- func JSONDecodeValue(s string) (vm.Value, error)
- func JSONEncodeArgs(args []vm.Value) (string, error)
- func LookupNS(name string) *vm.Namespace
- func LookupOrRegisterNS(name string) *vm.Namespace
- func LookupOrRegisterNSNoLoad(name string) *vm.Namespace
- func MarkNSNeedsLoad(name string)
- func NS(name string) *vm.Namespace
- func RegisterNS(namespace *vm.Namespace) *vm.Namespace
- func SetEvalInNS(fn func(string, *vm.Namespace) (vm.Value, error))
- func SetNSLoader(loader NSLoader)
- func SetReadEDN(fn func(string) (vm.Value, error))
- func ShutdownAllPods()
- func TransitDecodeValue(s string) (vm.Value, error)
- func TransitEncodeArgs(args []vm.Value) (string, error)
- type FileStat
- type HTTPRequest
- type HTTPResponse
- type Handler
- type IOHandle
- type LGBuffer
- type LGReader
- type LGURL
- type LGWriter
- type Mult
- type NSLoader
- type Pod
- type Pub
- type ShellResult
- type TransitDecoder
- type TransitEncoder
Constants ¶
const NameCoreNS = "core"
Variables ¶
var ( ReadableProto *vm.Protocol // method: -make-reader [x] → reader WritableProto *vm.Protocol // method: -make-writer [x] → writer )
IReadable and IWritable are the IO coercion protocols. Extending these allows user-defined types to participate in the IO system.
var AsyncSrc string
var CoreCompiledLGB []byte
var CoreNS *vm.Namespace
var CoreSrc string
var CurrentNS *vm.Var
var DataSrc string
var EdnSrc string
var IoSrc string
var PprintSrc string
var SetSrc string
var StringSrc string
var TestSrc string
var WalkSrc string
var ZipSrc string
Functions ¶
func DefNSBare ¶ added in v1.3.0
DefNSBare creates and registers a minimal namespace (with CoreNS refer) without triggering the loader. Used during bytecode decoding to create var homes for not-yet-loaded namespaces.
func DumpNamespaces ¶
func DumpNamespaces(fileName string)
func EDNEncodeArgs ¶ added in v1.1.0
EDNEncodeArgs encodes args as an EDN vector string.
func JSONDecodeValue ¶ added in v1.1.0
JSONDecodeValue decodes a JSON string into a vm.Value.
func JSONEncodeArgs ¶ added in v1.1.0
JSONEncodeArgs encodes args as a plain JSON array string.
func LookupNS ¶ added in v1.3.0
LookupNS returns a namespace if it exists, nil otherwise. Does not create.
func LookupOrRegisterNS ¶
func MarkNSNeedsLoad ¶ added in v1.3.0
func MarkNSNeedsLoad(name string)
MarkNSNeedsLoad flags a namespace as needing on-demand loading even though it already exists in the registry (created during bytecode decoding).
func SetEvalInNS ¶ added in v1.1.0
SetEvalInNS sets the namespace-aware eval function.
func SetNSLoader ¶
func SetNSLoader(loader NSLoader)
func SetReadEDN ¶ added in v1.1.0
SetReadEDN sets the EDN reader function (called by compiler package).
func ShutdownAllPods ¶ added in v1.1.0
func ShutdownAllPods()
ShutdownAllPods gracefully shuts down all loaded pods.
func TransitDecodeValue ¶ added in v1.1.0
TransitDecodeValue decodes a transit+json payload string.
Types ¶
type FileStat ¶
type FileStat struct {
Name string `letgo:"name"`
Size int64 `letgo:"size"`
IsDir bool `letgo:"dir?"`
ModTime string `letgo:"mod-time"`
}
FileStat is the struct behind os/stat return values.
type HTTPRequest ¶
type HTTPRequest struct {
RequestMethod string `letgo:"request-method"`
Scheme string `letgo:"scheme"`
URI string `letgo:"uri"`
Path string `letgo:"path"`
QueryString string `letgo:"query-string"`
Body string `letgo:"body"`
RemoteAddr string `letgo:"remote-addr"`
ServerAddr string `letgo:"server-addr"`
ServerPort string `letgo:"server-port"`
ContentType string `letgo:"content-type"`
Headers vm.Value `letgo:"headers"`
}
HTTPRequest is the struct behind ring-style HTTP request maps.
type HTTPResponse ¶
type HTTPResponse struct {
Status int `letgo:"status"`
Body vm.Value `letgo:"body"`
Headers vm.Value `letgo:"headers"`
}
HTTPResponse is the struct behind HTTP client response maps.
type IOHandle ¶
IOHandle wraps an *os.File with optional buffered reader for line-based reads.
func NewIOHandle ¶
type LGReader ¶
type LGReader struct {
// contains filtered or unexported fields
}
LGReader wraps any io.Reader with optional buffering and close.
type LGURL ¶
type LGURL struct {
Scheme string `letgo:"scheme"`
Host string `letgo:"host"`
Port string `letgo:"port"`
Path string `letgo:"path"`
Query string `letgo:"query"`
Fragment string `letgo:"fragment"`
UserInfo string `letgo:"user-info"`
Raw string `letgo:"raw"`
}
LGURL represents a parsed URL as a record.
type LGWriter ¶
type LGWriter struct {
// contains filtered or unexported fields
}
LGWriter wraps any io.Writer with optional buffering and close.
type Mult ¶
type Mult struct {
// contains filtered or unexported fields
}
Mult broadcasts values from a source channel to multiple tap channels.
type Pod ¶ added in v1.1.0
type Pod struct {
// contains filtered or unexported fields
}
Pod represents a running babashka pod subprocess.
func (*Pod) InvokeAsync ¶ added in v1.1.0
InvokeAsync calls a pod var and sends results to a channel. The channel stays open for streaming - the pod sends multiple values with the same id.
type Pub ¶
type Pub struct {
// contains filtered or unexported fields
}
Pub routes values from a source channel to subscribers by topic.
type ShellResult ¶
type ShellResult struct {
Exit int `letgo:"exit"`
Out string `letgo:"out"`
Err string `letgo:"err"`
}
ShellResult is the struct behind os/sh return values.
type TransitDecoder ¶ added in v1.1.0
type TransitDecoder struct {
// contains filtered or unexported fields
}
TransitDecoder decodes transit+json into vm.Values.
func NewTransitDecoder ¶ added in v1.1.0
func NewTransitDecoder() *TransitDecoder
NewTransitDecoder creates a new decoder with a fresh cache.
type TransitEncoder ¶ added in v1.1.0
type TransitEncoder struct {
// contains filtered or unexported fields
}
TransitEncoder encodes vm.Values to transit+json.
func NewTransitEncoder ¶ added in v1.1.0
func NewTransitEncoder() *TransitEncoder
NewTransitEncoder creates a new encoder with a fresh cache.
func (*TransitEncoder) Encode ¶ added in v1.1.0
func (e *TransitEncoder) Encode(v vm.Value) (string, error)
Encode encodes a vm.Value to a transit+json string.
func (*TransitEncoder) EncodeList ¶ added in v1.1.0
func (e *TransitEncoder) EncodeList(vals []vm.Value) (string, error)
EncodeList encodes a slice of values as a transit list (used for pod args).