Documentation ¶
Index ¶
- 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 Index
- type Marshaler
- 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 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 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 http.Header RemoteIP string UrlParams map[string]string Form url.Values Query url.Values PostForm url.Values 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.