Documentation
¶
Index ¶
- func ConvertToMap(p any) (map[string]any, error)
- func ConvertToStarlark(p any) (starlark.Value, error)
- func IsEmptyStarlarkString(s starlark.String) bool
- func MarshalStarlark(data interface{}) (v starlark.Value, err error)
- func UnmarshalStarlark(x starlark.Value) (val interface{}, err error)
- func UnquoteStarlark(x starlark.Value) (string, error)
- type DownloadStream
- type Index
- type Marshaler
- type Output
- 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
- func (s *StarlarkType) UnmarshalStarlarkType() (any, error)
- type StoreField
- type StoreInfo
- type StoreType
- type TypeBuilder
- type TypeName
- type TypeUnmarshaler
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToMap ¶ added in v0.15.14
ConvertToMap converts a struct to a map[string]any
func IsEmptyStarlarkString ¶
IsEmptyStarlarkString checks is a starlark string is empty ("" for a go string) starlark.String.String performs repr-style quotation, which is necessary for the starlark.Value contract but a frequent source of errors in API clients. This helper method makes sure it'll work properly
func MarshalStarlark ¶
MarshalStarlark turns go values into starlark types
func UnmarshalStarlark ¶
UnmarshalStarlark decodes a starlark.Value into it's golang counterpart
Types ¶
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 Marshaler ¶
type Marshaler interface {
// MarshalStarlark marshal a custom type to starlark object.
MarshalStarlark() (starlark.Value, error)
}
Marshaler is the interface use to marshal starlark custom types.
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
func (*StarlarkType) UnmarshalStarlarkType ¶
func (s *StarlarkType) UnmarshalStarlarkType() (any, error)
type StoreField ¶
type StoreType ¶
type StoreType struct {
Name string
Fields []StoreField
Indexes []Index
}
type TypeBuilder ¶
type TypeBuilder struct {
Name string
Fields []StoreField
}
type TypeUnmarshaler ¶
type TypeUnmarshaler interface {
// UnmarshalStarlark unmarshals a starlark object to go object
UnmarshalStarlarkType() (any, error)
}
Unmarshaler is the interface use to unmarshal starlark custom types.
type Unmarshaler ¶
type Unmarshaler interface {
// UnmarshalStarlark unmarshal a starlark object to custom type.
UnmarshalStarlark(starlark.Value) error
}
Unmarshaler is the interface use to unmarshal starlark custom types.