router

package
v0.0.3-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureAndBuildRouter

func ConfigureAndBuildRouter(starscript string, opts ...WithOption) (*mux.Router, error)

func SetDBPool

func SetDBPool(pool *pgxpool.Pool)

SetDBPool updates the dbpool pointer

func WithStarlarkHandler

func WithStarlarkHandler(rootdir, starfile string, globals map[string]starlark.Value, opts ...WithOption) func(http.ResponseWriter, *http.Request)

WithStarlarkHandler returns an http handler function that runs a starlark script

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func (*Config) AddRoute

func (cfg *Config) AddRoute(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*Config) BuildRouter

func (cfg *Config) BuildRouter() *mux.Router

func (*Config) EnableProfilerRoute

func (cfg *Config) EnableProfilerRoute(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*Config) GetEnv

func (cfg *Config) GetEnv(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*Config) NullFn

func (cfg *Config) NullFn(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*Config) SetGlobal

func (cfg *Config) SetGlobal(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

type WithOption

type WithOption interface {
	Apply(*executor.ManagedThread) error
}

type WithPrinter

type WithPrinter struct {
	PrintFn func(thread *starlark.Thread, msg string)
}

func WithNullPrinter

func WithNullPrinter() *WithPrinter

func (*WithPrinter) Apply

func (opt *WithPrinter) Apply(thread *executor.ManagedThread) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL