fx

package
v0.10.10 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 Fx

type Fx struct {
	*Circuit
	// contains filtered or unexported fields
}

func NewFx

func NewFx() *Fx

func (*Fx) Build added in v0.10.9

func (f *Fx) Build(elements ...*template.HTML)

Build registers a frame from its elements. The frame's root container is authored by the caller (template builder or custom frame file), not added here.

func (*Fx) BuildPanel added in v0.10.9

func (f *Fx) BuildPanel(elements ...*template.HTML) *template.HTML

BuildPanel consolidates elements into a single panel frame, the same way Build consolidates space frames. It does not register the frame — pass the result to Panels(...) to do that.

func (*Fx) Frame added in v0.10.9

func (f *Fx) Frame(path string)

Frame registers a frame from a local file. The file authors its own root container div (by convention <div class="<filename stem>">). Nothing is wrapped for you — the content is trusted as-is, so only pass local, developer-controlled paths.

func (*Fx) Frames added in v0.10.9

func (f *Fx) Frames(frame ...*template.HTML) *Value

func (*Fx) Markdown added in v0.10.9

func (f *Fx) Markdown() *markdown.Markdown

Markdown returns the configured goldmark instance for rendering markdown to HTML.

func (*Fx) Panel added in v0.10.10

func (f *Fx) Panel(path string) *template.HTML

Panel builds a panel frame from a local file. It does not register the frame — pass the result to Panels(...) to do that.

func (*Fx) Panels added in v0.10.9

func (f *Fx) Panels(panels ...*template.HTML) *Value

Panels registers any given panel frames, then returns the wire payload for every panel frame registered so far.

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