vector_inspector

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Dyntpl vector bindings

Provide vector and vector_inspector features to use in dyntpl templates.

Usage
package main

import (
	"github.com/koykov/dyntpl"
	_ "github.com/koykov/dyntpl_vector"    // register vector bindings
	_ "github.com/koykov/vector_inspector" // register vector inspector
)

const (
	tpl = `{% ctx data = vector::parseJSON(source).(vector) %}
output: {%= data.x.y.z %}`
	json = `{"x":{"y":{"z":"foobar"}}}`
)

func main() {
	tree, _ := dyntpl.Parse([]byte(tpl), false)
	dyntpl.RegisterTplKey("example", tree)
	ctx := dyntpl.NewCtx()
	ctx.SetString("source", json)
	result, _ := dyntpl.Render("example", ctx)
	println(string(result)) // output: foobar
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownType = errors.New("unknown vector type")

Functions

func VectorNodeEmptyCheck

func VectorNodeEmptyCheck(_ *dyntpl.Ctx, val any) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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