core

package
v1.0.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package core implements the TOML decoding and encoding primitives shared by the TOML module wrappers.

Index

Constants

View Source
const (
	DecodeDateTimeString = "string"
	DecodeDateTimeNative = "native"

	EncodeDateTimeRFC3339  = "rfc3339"
	EncodeDateTimePreserve = "preserve"
)

Variables

This section is empty.

Functions

func Decode

func Decode(ctx context.Context, data runtime.String, opts DecodeOptions) (runtime.Value, error)

Decode eagerly decodes a single TOML document into a Ferret runtime object.

func Encode

func Encode(ctx context.Context, value runtime.Value, opts EncodeOptions) (string, error)

Encode serializes a Ferret runtime value into TOML text.

func ResolveContent

func ResolveContent(input runtime.Value) (runtime.String, error)

ResolveContent normalizes supported TOML content input to a runtime.String. It accepts only runtime.String and runtime.Binary values.

Types

type DecodeOptions

type DecodeOptions struct {
	DateTime string
	Strict   bool
}

DecodeOptions configures TOML decoding behavior.

func DefaultDecodeOptions

func DefaultDecodeOptions() DecodeOptions

DefaultDecodeOptions returns the default TOML decode options.

func ParseDecodeOptions

func ParseDecodeOptions(ctx context.Context, input runtime.Value) (DecodeOptions, error)

ParseDecodeOptions validates and decodes TOML decode options.

type EncodeOptions

type EncodeOptions struct {
	DateTime string
	SortKeys bool
}

EncodeOptions configures TOML encoding behavior.

func DefaultEncodeOptions

func DefaultEncodeOptions() EncodeOptions

DefaultEncodeOptions returns the default TOML encode options.

func ParseEncodeOptions

func ParseEncodeOptions(ctx context.Context, input runtime.Value) (EncodeOptions, error)

ParseEncodeOptions validates and decodes TOML encode options.

type Error

type Error struct {
	Err error
	Msg string
}

Error reports a TOML-specific decode or encode failure.

func (*Error) Error

func (e *Error) Error() string

Error formats the TOML error with the module prefix.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the wrapped error, when present.

Jump to

Keyboard shortcuts

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