app

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPlugin

func RegisterPlugin(name string, plugin *starlarkstruct.Struct)

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 CreateDevModeHashDisable

func CreateDevModeHashDisable(logger *utils.Logger, fileData map[string]string) (*App, *util.AppFS, error)

func CreateDevModeTestApp

func CreateDevModeTestApp(logger *utils.Logger, fileData map[string]string) (*App, *util.AppFS, error)

func CreateTestApp

func CreateTestApp(logger *utils.Logger, fileData map[string]string) (*App, *util.AppFS, error)

func CreateTestAppInt

func CreateTestAppInt(logger *utils.Logger, path string, fileData map[string]string, isDev bool, disableHash bool) (*App, *util.AppFS, error)

func CreateTestAppRoot

func CreateTestAppRoot(logger *utils.Logger, fileData map[string]string) (*App, *util.AppFS, error)

func NewApp

func NewApp(sourceFS *util.AppFS, workFS *util.AppFS, logger *utils.Logger, appEntry *utils.AppEntry, systemConfig *utils.SystemConfig) *App

func (*App) Audit

func (a *App) Audit() (*utils.AuditResult, error)

func (*App) Close

func (a *App) Close() error

func (*App) Initialize

func (a *App) Initialize() error

func (*App) Reload

func (a *App) Reload(force bool) (bool, error)

func (*App) ServeHTTP

func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Request

type Request struct {
	AppName     string
	AppPath     string
	AppUrl      string
	PagePath    string
	PageUrl     string
	Method      string
	IsDev       bool
	AutoReload  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

func (Request) Attr

func (r Request) Attr(name string) (starlark.Value, error)

func (Request) AttrNames

func (r Request) AttrNames() []string

func (Request) Freeze

func (r Request) Freeze()

func (Request) Hash

func (r Request) Hash() (uint32, error)

func (Request) String

func (r Request) String() string

func (Request) Truth

func (r Request) Truth() starlark.Bool

func (Request) Type

func (r Request) Type() string

type SSEMessage

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

type TestFS

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

func (*TestFS) Glob

func (f *TestFS) Glob(pattern string) ([]string, error)

func (*TestFS) Open

func (f *TestFS) Open(name string) (fs.File, error)

func (*TestFS) ParseFS

func (f *TestFS) ParseFS(funcMap template.FuncMap, patterns ...string) (*template.Template, error)

func (*TestFS) ReadFile

func (f *TestFS) ReadFile(name string) ([]byte, error)

func (*TestFS) Remove

func (f *TestFS) Remove(name string) error

func (*TestFS) Stat

func (f *TestFS) Stat(name string) (fs.FileInfo, error)

func (*TestFS) Write

func (f *TestFS) Write(name string, bytes []byte) error

type TestFile

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

func CreateTestFile

func CreateTestFile(name string, data string) *TestFile

func (*TestFile) Close

func (f *TestFile) Close() error

func (*TestFile) Read

func (f *TestFile) Read(dst []byte) (int, error)

func (*TestFile) Stat

func (f *TestFile) Stat() (fs.FileInfo, error)

type TestFileInfo

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

func (*TestFileInfo) IsDir

func (fi *TestFileInfo) IsDir() bool

func (*TestFileInfo) ModTime

func (fi *TestFileInfo) ModTime() time.Time

func (*TestFileInfo) Mode

func (fi *TestFileInfo) Mode() fs.FileMode

func (*TestFileInfo) Name

func (fi *TestFileInfo) Name() string

func (*TestFileInfo) Size

func (fi *TestFileInfo) Size() int64

func (*TestFileInfo) Sys

func (fi *TestFileInfo) Sys() any

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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