Documentation
¶
Index ¶
- func FromGo(v any) (starlark.Value, error)
- func FromPlugin(v any, depth int, funcRefFn FuncRefValueFunc) (starlark.Value, error)
- func FromWire(v *pb.StarValue, cursorFn CursorValueFunc, funcRefFn WireFuncRefFunc, ...) (starlark.Value, error)
- func ToGo(v starlark.Value) (any, error)
- func ToPlugin(v starlark.Value, depth int) (any, error)
- func ToWire(v starlark.Value, depth int) (*pb.StarValue, error)
- type CursorValueFunc
- type DownloadStream
- type FuncRefValueFunc
- type GoValuer
- type Index
- type Output
- type PluginValuer
- type Request
- type StarlarkType
- func (s *StarlarkType) Attr(attr string) (starlark.Value, error)
- func (s *StarlarkType) AttrNames() []string
- func (s *StarlarkType) Freeze()
- func (s *StarlarkType) Hash() (uint32, error)
- func (s *StarlarkType) SetField(name string, val starlark.Value) error
- func (s *StarlarkType) String() string
- func (s *StarlarkType) Truth() starlark.Bool
- func (s *StarlarkType) Type() string
- type StoreField
- type StoreInfo
- type StoreType
- type TypeBuilder
- type TypeName
- type WireFuncRefFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromGo ¶ added in v0.19.2
FromGo converts application Go data to Starlark. In addition to the plugin value set it accepts the named map types used by HTTP requests.
func FromPlugin ¶ added in v0.19.2
FromPlugin converts a plugin SDK return value to Starlark.
func FromWire ¶ added in v0.19.2
func FromWire(v *pb.StarValue, cursorFn CursorValueFunc, funcRefFn WireFuncRefFunc, depth int) (starlark.Value, error)
FromWire converts a wire value into a starlark value. Typed structs become StarlarkType values (attribute access, mutable fields), matching what in-process plugins return. Cursors are materialized via cursorFn; a nil cursorFn rejects cursors (e.g. in constants).
func ToGo ¶ added in v0.19.2
ToGo converts a Starlark value to application-friendly Go data for JSON, templates, configuration, and schema values. It intentionally retains the established application contract: integers are int, homogeneous lists are specialized (for example []string), and typed values become plain maps.
func ToPlugin ¶ added in v0.19.2
ToPlugin converts a Starlark value to the plugin SDK representation while preserving Starlark-specific types such as tuples, sets, ordered dicts, large integers, and typed structs.
func ToWire ¶ added in v0.19.2
ToWire converts a starlark value into its wire representation for a plugin provider call, in a single pass with no intermediate Go value tree. Fidelity notes: int64-representable ints use the int fast path and larger ints go as big ints; int and float stay distinct; tuple/set/bytes are preserved; dict entries keep insertion order; StarlarkType values become typed structs.
Types ¶
type CursorValueFunc ¶ added in v0.19.2
CursorValueFunc materializes a wire cursor handle into a starlark value; supplied by the remote call path, which knows the session and provider.
type DownloadStream ¶ added in v0.18.7
type DownloadStream struct {
// contains filtered or unexported fields
}
DownloadStream is an opaque starlark value carrying a lazily produced download body. Only plugin Go code can construct one; app starlark code can just pass it through into ace.response(data=..., download=...) - it exposes no attributes, so a handler cannot fabricate or inspect one. The producer is invoked by the download response handler at response-write time, writing the body into the response buffer: the payload is never fully materialized in memory or staged to disk, and once the buffer fills a stalled client blocks the producer (TCP backpressure). Single use: a second Produce errors instead of silently sending an empty body.
func NewDownloadStream ¶ added in v0.18.7
func NewDownloadStream(name string, producer func(w io.Writer) error) *DownloadStream
func (*DownloadStream) Freeze ¶ added in v0.18.7
func (d *DownloadStream) Freeze()
Freeze is a no-op: the value is consumed by the single request thread that created it, never shared across starlark threads
func (*DownloadStream) Hash ¶ added in v0.18.7
func (d *DownloadStream) Hash() (uint32, error)
func (*DownloadStream) Name ¶ added in v0.18.7
func (d *DownloadStream) Name() string
Name is the download attachment file name
func (*DownloadStream) Produce ¶ added in v0.18.7
func (d *DownloadStream) Produce(w io.Writer) error
Produce writes the body to w. It may block on w (the response writer) when the client is slow to read
func (*DownloadStream) String ¶ added in v0.18.7
func (d *DownloadStream) String() string
func (*DownloadStream) Truth ¶ added in v0.18.7
func (d *DownloadStream) Truth() starlark.Bool
func (*DownloadStream) Type ¶ added in v0.18.7
func (d *DownloadStream) Type() string
type FuncRefValueFunc ¶ added in v0.19.2
FuncRefValueFunc materializes an SDK function reference as a Starlark callable. It is supplied by plugin dispatch, which owns the module and session needed to invoke the reference.
type GoValuer ¶ added in v0.19.2
GoValuer converts a custom Starlark value to its application Go representation.
type PluginValuer ¶ added in v0.19.2
PluginValuer converts a custom Starlark value to its plugin SDK representation, for values passed from one plugin call into another.
type Request ¶
type Request struct {
AppName string
AppPath string
AppUrl string
PagePath string
PageUrl string
Method string
IsDev bool
IsPartial bool
PushEvents bool
HtmxVersion string
// Headers is the sanitized request header view exposed as req.Headers. It
// is built lazily by HeadersFunc on first access, since most handlers never
// read headers and cloning the whole header map per request is expensive.
// Set Headers directly (with HeadersFunc nil) when the value is already
// known.
Headers http.Header
HeadersFunc func() http.Header
RemoteIP string
UrlParams map[string]string
Form url.Values
Query url.Values
PostForm url.Values
UserId string
UserSubject string
UserEmail string
CustomPerms []string
AppRBACEnabled bool
Data any
}
Request is a starlark.Value that represents an HTTP request. A Request is created from the Go http.Request and passed to the starlark handler function as it only argument. The Data field is updated with the handler's response and then the template evaluation is done with the same Request
type StarlarkType ¶
type StarlarkType struct {
// contains filtered or unexported fields
}
StarlarkType represents a Starlark type created from the schema type definition.
func NewStarlarkType ¶
func NewStarlarkType(name string, data map[string]starlark.Value) *StarlarkType
func (*StarlarkType) AttrNames ¶
func (s *StarlarkType) AttrNames() []string
func (*StarlarkType) Freeze ¶
func (s *StarlarkType) Freeze()
func (*StarlarkType) Hash ¶
func (s *StarlarkType) Hash() (uint32, error)
func (*StarlarkType) SetField ¶
func (s *StarlarkType) SetField(name string, val starlark.Value) error
func (*StarlarkType) String ¶
func (s *StarlarkType) String() string
func (*StarlarkType) Truth ¶
func (s *StarlarkType) Truth() starlark.Bool
func (*StarlarkType) Type ¶
func (s *StarlarkType) Type() string
type StoreField ¶
type StoreType ¶
type StoreType struct {
Name string
Fields []StoreField
Indexes []Index
}
type TypeBuilder ¶
type TypeBuilder struct {
Name string
Fields []StoreField
}
type WireFuncRefFunc ¶ added in v0.19.2
WireFuncRefFunc materializes a wire func ref into a starlark callable that dispatches the referenced plugin function; supplied by the remote call path. A nil WireFuncRefFunc rejects func refs (e.g. in constants).