Documentation
¶
Index ¶
- Constants
- func ClearCleanup(thread *starlark.Thread, key string)
- func CreatePluginApi(f StarlarkFunction, opType PluginFunctionType) utils.PluginFunc
- func CreatePluginApiName(...) utils.PluginFunc
- func DeferCleanup(thread *starlark.Thread, key string, deferFunc DeferFunc, strict bool)
- func FetchPluginState(thread *starlark.Thread, key string) any
- func GetContext(thread *starlark.Thread) context.Context
- func RegisterPlugin(name string, builder utils.NewPluginFunc, funcs []utils.PluginFunc)
- func SavePluginState(thread *starlark.Thread, key string, value any)
- type App
- type AppPlugins
- type DeferEntry
- type DeferFunc
- type PluginFunctionType
- type Request
- type SSEMessage
- type StarlarkFunction
Constants ¶
const ( TL_CONTEXT = "TL_context" TL_DEFER_MAP = "TL_defer_map" TL_CURRENT_MODULE_FULL_PATH = "TL_current_module_full_path" )
Variables ¶
This section is empty.
Functions ¶
func ClearCleanup ¶ added in v0.4.1
ClearCleanup clears a defer function from the thread local
func CreatePluginApi ¶ added in v0.3.0
func CreatePluginApi(f StarlarkFunction, opType PluginFunctionType) utils.PluginFunc
func CreatePluginApiName ¶ added in v0.4.0
func CreatePluginApiName( f func(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error), opType PluginFunctionType, name string) utils.PluginFunc
CreatePluginApiName creates a Clace plugin function
func DeferCleanup ¶ added in v0.4.1
DeferCleanup defers a close function to call when the API handler is done
func FetchPluginState ¶ added in v0.4.1
FetchPluginState fetches a value from the thread local for the plugin
func RegisterPlugin ¶
func RegisterPlugin(name string, builder utils.NewPluginFunc, funcs []utils.PluginFunc)
RegisterPlugin registers a plugin with Clace
Types ¶
type App ¶
type App struct { *utils.Logger *utils.AppEntry Name string CustomLayout bool Config *util.AppConfig // contains filtered or unexported fields }
App is the main object that represents a Clace app. It is created when the app is loaded
func (*App) Initialize ¶
type AppPlugins ¶ added in v0.4.0
func NewAppPlugins ¶ added in v0.4.0
func NewAppPlugins(app *App, pluginConfig map[string]utils.PluginSettings, appAccounts []utils.AccountLink) *AppPlugins
func (*AppPlugins) GetPlugin ¶ added in v0.4.0
func (p *AppPlugins) GetPlugin(pluginInfo *utils.PluginInfo, accountName string) (any, error)
type DeferEntry ¶ added in v0.4.1
type PluginFunctionType ¶ added in v0.4.0
type PluginFunctionType int
const ( READ PluginFunctionType = iota WRITE READ_WRITE )
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 SSEMessage ¶
type SSEMessage struct {
// contains filtered or unexported fields
}