processor

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 22 Imported by: 0 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatScalarValue

func FormatScalarValue(value Value) (string, error)

func ParseInjectionRecord

func ParseInjectionRecord(input string) (map[string]Value, error)

func ParseInputRecord

func ParseInputRecord(input string) (map[string]Value, error)

Types

type DiagnosticError

type DiagnosticError struct {
	Kind    ErrorKind
	Code    ErrorCode
	Message string
	Range   diagnostic.Range
	Fields  DiagnosticFields
	Cause   error
}

func (DiagnosticError) Error

func (err DiagnosticError) Error() string

func (DiagnosticError) Unwrap

func (err DiagnosticError) Unwrap() error

type DiagnosticFields

type DiagnosticFields struct {
	Name     string
	Field    string
	Schema   string
	Expected string
	Actual   string
	Operator string
	Path     string
	Details  map[string]string
}

type ErrorCode

type ErrorCode string
const (
	CodeAbsentValueNotCoalesced      ErrorCode = "mace.type.absent-value-not-coalesced"
	CodeImportFileFailedParse        ErrorCode = "mace.import.file-failed-to-parse"
	CodeImportFileNotFound           ErrorCode = "mace.import.file-not-found"
	CodeInternal                     ErrorCode = "mace.internal"
	CodeInvalidNullUsage             ErrorCode = "mace.type.invalid-null-usage"
	CodeInvalidOutputSchemaField     ErrorCode = "mace.type.invalid-output-schema-field"
	CodeMissingRequiredField         ErrorCode = "mace.type.record-does-not-match-schema"
	CodeOptionalFieldAccess          ErrorCode = "mace.type.optional-field-access"
	CodeOutputValueDeclaration       ErrorCode = "mace.type.unknown-identifier"
	CodeSelfReferenceUnknown         ErrorCode = "mace.type.unknown-self-field"
	CodeTypeMismatch                 ErrorCode = "mace.type.initializer-type-mismatch"
	CodeTypeRecordDoesNotMatchSchema ErrorCode = "mace.type.record-does-not-match-schema"
	CodeRuntimeDuplicateInputField   ErrorCode = "mace.runtime.duplicate-input-field"
	CodeSchemaAndSchemaFileCombined  ErrorCode = "mace.directive.schema-and-schema-file-combined"
)

type ErrorKind

type ErrorKind string
const (
	ErrorLexical     ErrorKind = "lexical"
	ErrorSyntax      ErrorKind = "syntax"
	ErrorDoc         ErrorKind = "doc"
	ErrorImport      ErrorKind = "import"
	ErrorDirective   ErrorKind = "directive"
	ErrorDeclaration ErrorKind = "declaration"
	ErrorType        ErrorKind = "type"
	ErrorValue       ErrorKind = "value"
	ErrorOperator    ErrorKind = "operator"
	ErrorSchema      ErrorKind = "schema"
	ErrorRuntime     ErrorKind = "runtime"
	ErrorInternal    ErrorKind = "internal"
)

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

func New

func New() *Processor

func NewWithInjections

func NewWithInjections(injections map[string]Value) *Processor

func NewWithInput

func NewWithInput(input map[string]Value) *Processor

func (*Processor) Process

func (p *Processor) Process(input string) (Result, error)

func (*Processor) ProcessFile

func (p *Processor) ProcessFile(path string) (Result, error)

func (*Processor) ProcessFileInDir

func (p *Processor) ProcessFileInDir(path string, importRootDir string) (Result, error)

func (*Processor) ProcessInDir

func (p *Processor) ProcessInDir(input string, importBaseDir string) (Result, error)

func (*Processor) ProcessInScope

func (p *Processor) ProcessInScope(input string, importBaseDir string, importRootDir string) (Result, error)

func (*Processor) ProcessOutputBlock

func (p *Processor) ProcessOutputBlock(input string, scriptResult ScriptResult) (Result, error)

func (*Processor) ProcessScriptBlock

func (p *Processor) ProcessScriptBlock(input string) (ScriptResult, error)

func (*Processor) ProcessVariablesInDir

func (p *Processor) ProcessVariablesInDir(input string, importBaseDir string) (map[string]Value, error)

func (*Processor) ProcessVariablesInScope

func (p *Processor) ProcessVariablesInScope(input string, importBaseDir string, importRootDir string) (map[string]Value, error)

type Result

type Result struct {
	File      ast.File
	Output    map[string]Value
	Schema    map[SchemaField]SchemaType
	Variables map[string]Value
}

type SchemaField

type SchemaField struct {
	Name     string
	Optional bool
}

type SchemaType

type SchemaType struct {
	Kind    SchemaTypeKind
	Name    string
	Element *SchemaType
	Fields  map[SchemaField]SchemaType
	Members []SchemaType
}

type SchemaTypeKind

type SchemaTypeKind int
const (
	SchemaTypeUnknown SchemaTypeKind = iota
	SchemaTypePrimitive
	SchemaTypeNamed
	SchemaTypeArray
	SchemaTypeRecord
	SchemaTypeUnion
	SchemaTypeVariant
	SchemaTypeRecordMap
)

type ScriptResult

type ScriptResult struct {
	Script    ast.ScriptBlock
	Variables map[string]Value
	// contains filtered or unexported fields
}

type Value

type Value struct {
	Absent  bool
	Kind    ValueKind
	Int     int64
	Float   float64
	Boolean bool
	String  string
	Array   []Value
	Record  map[string]Value
	Type    *valueType
}

type ValueKind

type ValueKind int
const (
	ValueUnknown ValueKind = iota
	ValueNull
	ValueString
	ValueInt
	ValueFloat
	ValueHexInt
	ValueHexFloat
	ValueBoolean
	ValueArray
	ValueRecord
)

Jump to

Keyboard shortcuts

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