fx

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Unlicense Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attr

type Attr map[string]string

Attr is a map of HTML attribute key-value pairs passed to any element builder.

type Circuit added in v0.10.5

type Circuit struct {
	Routes map[string]*Value
}

func NewCircuit added in v0.10.5

func NewCircuit() *Circuit

func (*Circuit) Compress added in v0.10.5

func (c *Circuit) Compress(data []byte) []byte

Compress gzip-compresses data at maximum compression. Bundles are compressed once at build time and served directly with Content-Encoding: gzip.

func (*Circuit) Decode added in v0.10.6

func (c *Circuit) Decode(buf []byte) []*Value

Decode is the inverse of Encode.

func (*Circuit) Encode added in v0.10.6

func (c *Circuit) Encode(v *Value) []byte

Encode flattens a Value tree to its leaves in order and writes the wire format the client decodes: repeated, back-to-back, per leaf:

[1B typeLen][type] [4B dataLen][data]

There is no leaf count on the wire — the response's length is the terminator. Names are not encoded — order is the contract.

func (*Circuit) Load added in v0.10.5

func (c *Circuit) Load(path string)

Load reads a file or directory at path and stores it in Routes keyed by the base name of path. A file becomes a leaf Value; a directory becomes a bundle. An http(s) path is treated as a pre-encoded wire blob (from Save) and decoded back into a bundle.

func (*Circuit) Save added in v0.10.6

func (c *Circuit) Save(key string) error

Save writes the wire-encoded bytes of the route at key to s3/key, ready to be synced to S3 (e.g. rclone sync s3 remote:bucket) under the same object name Load expects when fetching it back.

func (*Circuit) ToBytes added in v0.10.5

func (c *Circuit) ToBytes(input string) ([]byte, error)

ToBytes fetches the content at input, either from an HTTP URL or a local file.

type Forge

type Forge interface {
	HTML(raw string) *template.HTML
	Build(elements ...*template.HTML)
	Builder(elements ...*template.HTML) *template.HTML
	Frames(frame ...*template.HTML) [][]byte
	Markdown() *markdown.Markdown
	JS(path string) *template.HTML
	CSS(css string) *template.HTML
	Elem(tag, text string, attrs ...Attr) *template.HTML
	Block(tag string, attrs Attr, children ...*template.HTML) *template.HTML
	Void(tag string, attrs Attr) *template.HTML
}

func NewForge

func NewForge() Forge

type Fx

type Fx struct {
	*zero.Zero
	Forge
	*Circuit
}

func NewFx

func NewFx(z *zero.Zero) *Fx

type Value

type Value struct {
	Name   string
	Type   string
	Data   []byte
	Values []*Value
}

Value is one encoded entry, or a bundle of them. A leaf carries Type + Data; a bundle carries Values (its children). Name is server-internal — used for sort.txt ordering — and is never written to the wire.

Jump to

Keyboard shortcuts

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