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

match

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

A missing key is not null. ##string allows missing, null, or a string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Root   any
	Truthy func(expr string, self, root any) (bool, error)
	Eval   func(expr string) (any, error)
	// contains filtered or unexported fields
}

type Failure

type Failure struct {
	Path     string
	Reason   string
	Actual   string
	Expected string
}

type Mode

type Mode int
const (
	Equals Mode = iota
	NotEquals
	Contains
	NotContains
	ContainsOnly
	ContainsDeep
	ContainsOnlyDeep
	ContainsAny
	ContainsAnyDeep
	Within
	NotWithin
)

func (Mode) String

func (m Mode) String() string

type Result

type Result struct {
	Pass     bool
	Message  string
	Failures []Failure
}

func Match

func Match(actual, expected any, mode Mode, ctx Context) Result

func MatchEach

func MatchEach(actual, expected any, mode Mode, ctx Context) Result

Jump to

Keyboard shortcuts

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