Help us shape the future of Go! Take the 2026 Go Developer Survey

asm

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Example (Inspect)
package main

import (
	"fmt"

	"github.com/ohler55/ojg/asm"
	"github.com/ohler55/ojg/jp"
)

func main() {
	p := asm.NewPlan([]interface{}{
		"asm",
		[]interface{}{"inspect", 0, "one", []interface{}{1}, "@", jp.C("src").N(1), "test", "$"},
	})
	root := map[string]interface{}{
		"src": []interface{}{1, int64(2), 3},
	}
	if err := p.Execute(root); err != nil {
		fmt.Println(err.Error())
	}
}
Output:
one: [1]
{"src":[1,2,3]}
test:
{
  "src": [
    1,
    2,
    3
  ]
}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Define

func Define(f *Fn)

func FnDocs

func FnDocs() map[string]string

Types

type Fn

type Fn struct {
	Name    string
	Eval    func(root map[string]interface{}, at interface{}, args ...interface{}) interface{}
	Args    []interface{}
	Desc    string
	Compile func(*Fn)
	// contains filtered or unexported fields
}

func NewFn

func NewFn(name string) (fn *Fn)

func (*Fn) Simplify

func (f *Fn) Simplify() interface{}

func (*Fn) String

func (f *Fn) String() string

type Plan

type Plan struct {
	Fn
}

func NewPlan

func NewPlan(plan []interface{}) *Plan

func (*Plan) Execute

func (p *Plan) Execute(root map[string]interface{}) (err error)

Jump to

Keyboard shortcuts

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