Versions in this module Expand all Collapse all v0 v0.8.0 Oct 16, 2026 Changes in this version type Document + func (d *Document) SetBools(path string, values []bool) error + func (d *Document) SetCreateBools(path string, values []bool) error + func (d *Document) SetCreateFloats(path string, values []float64) error + func (d *Document) SetCreateInlineTable(path string, table InlineTable) error + func (d *Document) SetCreateInts(path string, values []int64) error + func (d *Document) SetCreateStrings(path string, values []string) error + func (d *Document) SetFloats(path string, values []float64) error + func (d *Document) SetInlineTable(path string, table InlineTable) error + func (d *Document) SetInts(path string, values []int64) error + func (d *Document) SetStrings(path string, values []string) error + type InlineTable struct + func (t *InlineTable) Bool(key string, value bool) *InlineTable + func (t *InlineTable) Bools(key string, values []bool) *InlineTable + func (t *InlineTable) Float(key string, value float64) *InlineTable + func (t *InlineTable) Floats(key string, values []float64) *InlineTable + func (t *InlineTable) Int(key string, value int64) *InlineTable + func (t *InlineTable) Ints(key string, values []int64) *InlineTable + func (t *InlineTable) String(key, value string) *InlineTable + func (t *InlineTable) Strings(key string, values []string) *InlineTable + func (t *InlineTable) Table(key string, table InlineTable) *InlineTable v0.7.0 Oct 15, 2026 Changes in this version type Document + func ParseWithFileName(src []byte, file string) (*Document, error) + func (d *Document) RoundTripVerifiedBytes(file string) ([]byte, error) v0.6.0 Oct 15, 2026 Changes in this version + var ErrInvalidValue error = kindError(KindInvalidValue) + func PathWithoutIndices(path string) string + type Collector struct + func (c *Collector) Add(err error) + func (c *Collector) Err() error + func (c *Collector) Errorf(file string, line int, path, format string, args ...any) + func (c *Collector) Len() int + func (c *Collector) Read(file string, data []byte) *Reader type Error + Fix string type ErrorKind + const KindInvalidValue type Errors + func (e *Errors) Diagnostics() []*Error + type Reader struct + func (r *Reader) Boolean(key string, required bool) (bool, bool) + func (r *Reader) Child(path string, v Value) *Reader + func (r *Reader) Done() + func (r *Reader) Errorf(key, format string, args ...any) + func (r *Reader) ErrorfAt(line int, path, format string, args ...any) + func (r *Reader) File() string + func (r *Reader) Flag(key string) bool + func (r *Reader) Get(key string) (Value, bool) + func (r *Reader) Has(key string) bool + func (r *Reader) Integer(key string, required bool, write string) (int64, bool) + func (r *Reader) KeyPath(key string) string + func (r *Reader) Keys() []string + func (r *Reader) Line(key string) int + func (r *Reader) Lines() map[string]int + func (r *Reader) Missing(key, write string) + func (r *Reader) NonEmpty(key, write string) + func (r *Reader) Path() string + func (r *Reader) Peek(key string) (Value, bool) + func (r *Reader) PeekTrue(key string) bool + func (r *Reader) Str(key string, required bool, write string) (string, bool) + func (r *Reader) StrList(key string, required bool, write string) ([]string, bool) + func (r *Reader) Sub(key string) *Reader + func (r *Reader) TableLine() int + func (r *Reader) Tables(key string) []*Reader + func (r *Reader) WrongKind(key string, v Value, want, write string) + type Value struct + func (v Value) Bool() bool + func (v Value) Describe() string + func (v Value) Float() float64 + func (v Value) Int() int64 + func (v Value) Line() int + func (v Value) List() []Value + func (v Value) Node() (Node, bool) + func (v Value) Text() string + func (v Value) Type() ValueType + type ValueType int + const ValueBoolean + const ValueDateTime + const ValueFloat + const ValueInteger + const ValueList + const ValueString + const ValueTable + func (t ValueType) String() string v0.5.1 Oct 8, 2026 v0.5.0 Oct 6, 2026 Changes in this version + var ErrBadInput error = kindError(KindBadInput) + var ErrBadPath error = kindError(KindBadPath) + var ErrConflict error = kindError(KindConflict) + var ErrInexact error = kindError(KindInexact) + var ErrMissingKey error = kindError(KindMissingKey) + var ErrNotFound error = kindError(KindNotFound) + var ErrRoundTrip error = kindError(KindRoundTrip) + var ErrSkipTable = errors.New("skip table") + var ErrSyntax error = kindError(KindSyntax) + var ErrTypeMismatch error = kindError(KindTypeMismatch) + var ErrUnknownKey error = kindError(KindUnknownKey) + var ErrUnknownTable error = kindError(KindUnknownTable) + var ErrWrongContainer error = kindError(KindWrongContainer) + func DecodeNode[T any](n Node) (*T, error) + func DecodeOver[T any](d *Document, seed func() T) (*T, []string, error) + func Decode[T any](d *Document) (*T, error) + func FormatFloat(f float64) string + func JoinPath(segs []PathSegment) string + func QuoteKey(s string) string + func QuoteString(s string) string + func Unmarshal[T any](data []byte) (*T, error) + type ArrayNode struct + func (n *ArrayNode) Comment() string + func (n *ArrayNode) Elements() []Node + func (n *ArrayNode) LeadingComments() []string + func (n *ArrayNode) Raw() []byte + func (n *ArrayNode) Span() Span + func (n *ArrayNode) Type() NodeType + type ArrayTableNode struct + func (n *ArrayTableNode) Children() []Node + func (n *ArrayTableNode) Comment() string + func (n *ArrayTableNode) KeyPath() []string + func (n *ArrayTableNode) LeadingComments() []string + func (n *ArrayTableNode) Raw() []byte + func (n *ArrayTableNode) Span() Span + func (n *ArrayTableNode) Type() NodeType + type BooleanNode struct + func (n *BooleanNode) AsBool() (bool, error) + func (n *BooleanNode) AsFloat() (float64, error) + func (n *BooleanNode) AsInt() (int64, error) + func (n *BooleanNode) AsLocalDate() (LocalDate, error) + func (n *BooleanNode) AsLocalDateTime() (LocalDateTime, error) + func (n *BooleanNode) AsLocalTime() (LocalTime, error) + func (n *BooleanNode) AsString() (string, error) + func (n *BooleanNode) AsTime() (time.Time, error) + func (n *BooleanNode) Comment() string + func (n *BooleanNode) LeadingComments() []string + func (n *BooleanNode) Raw() []byte + func (n *BooleanNode) Span() Span + func (n *BooleanNode) Type() NodeType + func (n *BooleanNode) Value() any + type Change struct + Kind ChangeKind + NewValue any + OldValue any + Path string + func Diff(a, b *Document) []Change + type ChangeKind int + const Added + const Modified + const Removed + func (k ChangeKind) String() string + type CommentNode struct + func (n *CommentNode) Comment() string + func (n *CommentNode) LeadingComments() []string + func (n *CommentNode) Raw() []byte + func (n *CommentNode) Span() Span + func (n *CommentNode) Text() string + func (n *CommentNode) Type() NodeType + type Cursor struct + func (c *Cursor) At(index int) *Cursor + func (c *Cursor) Bool() (bool, error) + func (c *Cursor) Err() error + func (c *Cursor) Float() (float64, error) + func (c *Cursor) Int() (int64, error) + func (c *Cursor) Items() iter.Seq2[int, Node] + func (c *Cursor) Key(name string) *Cursor + func (c *Cursor) Len() int + func (c *Cursor) Node() Node + func (c *Cursor) String() (string, error) + func (c *Cursor) Time() (time.Time, error) + type DateTimeNode struct + func (n *DateTimeNode) AsBool() (bool, error) + func (n *DateTimeNode) AsFloat() (float64, error) + func (n *DateTimeNode) AsInt() (int64, error) + func (n *DateTimeNode) AsLocalDate() (LocalDate, error) + func (n *DateTimeNode) AsLocalDateTime() (LocalDateTime, error) + func (n *DateTimeNode) AsLocalTime() (LocalTime, error) + func (n *DateTimeNode) AsString() (string, error) + func (n *DateTimeNode) AsTime() (time.Time, error) + func (n *DateTimeNode) Comment() string + func (n *DateTimeNode) LeadingComments() []string + func (n *DateTimeNode) Raw() []byte + func (n *DateTimeNode) Span() Span + func (n *DateTimeNode) Type() NodeType + func (n *DateTimeNode) Value() any + type Default struct + Path string + Value any + type Document struct + func Parse(src []byte) (*Document, error) + func ParseFile(path string) (*Document, error) + func (d *Document) AppendToArray(path string, value any) error + func (d *Document) Bytes() []byte + func (d *Document) DecodeSpec(spec *Spec) (map[string]any, error) + func (d *Document) Delete(path string) error + func (d *Document) EnsureDefaults(defaults []Default) (added []string, err error) + func (d *Document) Format(opts ...FormatOption) []byte + func (d *Document) GetBool(path string) (bool, error) + func (d *Document) GetComment(path string) (string, error) + func (d *Document) GetFloat(path string) (float64, error) + func (d *Document) GetInt(path string) (int64, error) + func (d *Document) GetLeadingComments(path string) ([]string, error) + func (d *Document) GetString(path string) (string, error) + func (d *Document) GetTime(path string) (time.Time, error) + func (d *Document) Has(path string) bool + func (d *Document) Key(name string) *Cursor + func (d *Document) Lookup(path string) (Node, bool) + func (d *Document) Merge(other *Document) error + func (d *Document) NewArrayTable(path string) error + func (d *Document) NewTable(path string) error + func (d *Document) PermuteChildren(path string, order []int) error + func (d *Document) RemoveFromArray(path string, index int) error + func (d *Document) RenameKey(path string, newKey string) error + func (d *Document) Resolve(path string) (Node, error) + func (d *Document) Root() *Record + func (d *Document) Set(path string, value any) error + func (d *Document) SetComment(path string, comment string) error + func (d *Document) SetCreate(path string, value any) error + func (d *Document) SetLeadingComments(path string, comments []string) error + func (d *Document) Validate(spec *Spec) error + func (d *Document) Walk(fn func(path string, node Node) error, mode WalkMode) error + func (d *Document) WriteFile(path string) error + func (n *Document) Children() []Node + func (n *Document) Comment() string + func (n *Document) LeadingComments() []string + func (n *Document) Raw() []byte + func (n *Document) Span() Span + func (n *Document) Type() NodeType + type Entry struct + func (e Entry) Key() string + func (e Entry) KeySpan() Span + func (e Entry) Kind() EntryKind + func (e Entry) Node() (Node, bool) + func (e Entry) Record() (*Record, bool) + func (e Entry) Records() ([]*Record, bool) + func (e Entry) RecordsSpan() Span + type EntryKind int + const EntryRecord + const EntryRecords + const EntryValue + func (k EntryKind) String() string + type Error struct + Expected string + File string + Got string + Keys []string + Kind ErrorKind + Message string + Offset int + Path string + Pos Position + Snippet string + Span Span + Value any + func (e *Error) Error() string + func (e *Error) Is(target error) bool + func (e *Error) Unwrap() error + type ErrorKind int + const KindBadInput + const KindBadPath + const KindConflict + const KindInexact + const KindMissingKey + const KindNotFound + const KindRoundTrip + const KindSyntax + const KindTypeMismatch + const KindUnknownKey + const KindUnknownTable + const KindWrongContainer + func (k ErrorKind) String() string + type Errors struct + func (e *Errors) Error() string + func (e *Errors) Unwrap() []error + type Field struct + Elem *Field + Kind FieldKind + Required bool + Table *Spec + func FieldAny() Field + type FieldKind int + const FieldKindAny + const FieldKindArray + const FieldKindBoolean + const FieldKindFloat + const FieldKindInteger + const FieldKindLocalDate + const FieldKindLocalDateTime + const FieldKindLocalTime + const FieldKindOffsetDateTime + const FieldKindString + const FieldKindTable + func (k FieldKind) String() string + type FloatNode struct + func (n *FloatNode) AsBool() (bool, error) + func (n *FloatNode) AsFloat() (float64, error) + func (n *FloatNode) AsInt() (int64, error) + func (n *FloatNode) AsLocalDate() (LocalDate, error) + func (n *FloatNode) AsLocalDateTime() (LocalDateTime, error) + func (n *FloatNode) AsLocalTime() (LocalTime, error) + func (n *FloatNode) AsString() (string, error) + func (n *FloatNode) AsTime() (time.Time, error) + func (n *FloatNode) Comment() string + func (n *FloatNode) LeadingComments() []string + func (n *FloatNode) Raw() []byte + func (n *FloatNode) Span() Span + func (n *FloatNode) Type() NodeType + func (n *FloatNode) Value() any + type FormatConfig struct + IndentWidth int + LineWidth int + func DefaultFormatConfig() FormatConfig + type FormatOption func(*FormatConfig) + func WithIndentWidth(n int) FormatOption + func WithLineWidth(n int) FormatOption + type InlineTableNode struct + func (n *InlineTableNode) Children() []Node + func (n *InlineTableNode) Comment() string + func (n *InlineTableNode) LeadingComments() []string + func (n *InlineTableNode) Raw() []byte + func (n *InlineTableNode) Span() Span + func (n *InlineTableNode) Type() NodeType + type IntegerBase int + const IntegerBinary + const IntegerDecimal + const IntegerHex + const IntegerOctal + type IntegerNode struct + func (n *IntegerNode) AsBool() (bool, error) + func (n *IntegerNode) AsFloat() (float64, error) + func (n *IntegerNode) AsInt() (int64, error) + func (n *IntegerNode) AsLocalDate() (LocalDate, error) + func (n *IntegerNode) AsLocalDateTime() (LocalDateTime, error) + func (n *IntegerNode) AsLocalTime() (LocalTime, error) + func (n *IntegerNode) AsString() (string, error) + func (n *IntegerNode) AsTime() (time.Time, error) + func (n *IntegerNode) Base() IntegerBase + func (n *IntegerNode) Comment() string + func (n *IntegerNode) LeadingComments() []string + func (n *IntegerNode) Raw() []byte + func (n *IntegerNode) Span() Span + func (n *IntegerNode) Type() NodeType + func (n *IntegerNode) Value() any + type KeyNode struct + func (n *KeyNode) Comment() string + func (n *KeyNode) LeadingComments() []string + func (n *KeyNode) Parts() []string + func (n *KeyNode) Raw() []byte + func (n *KeyNode) RawParts() [][]byte + func (n *KeyNode) Span() Span + func (n *KeyNode) Styles() []StringStyle + func (n *KeyNode) Type() NodeType + type KeyValueNode struct + func (n *KeyValueNode) Comment() string + func (n *KeyValueNode) Key() *KeyNode + func (n *KeyValueNode) LeadingComments() []string + func (n *KeyValueNode) Raw() []byte + func (n *KeyValueNode) Span() Span + func (n *KeyValueNode) Type() NodeType + func (n *KeyValueNode) Val() Node + type LocalDate struct + Day int + Month int + Year int + type LocalDateNode struct + func (n *LocalDateNode) AsBool() (bool, error) + func (n *LocalDateNode) AsFloat() (float64, error) + func (n *LocalDateNode) AsInt() (int64, error) + func (n *LocalDateNode) AsLocalDate() (LocalDate, error) + func (n *LocalDateNode) AsLocalDateTime() (LocalDateTime, error) + func (n *LocalDateNode) AsLocalTime() (LocalTime, error) + func (n *LocalDateNode) AsString() (string, error) + func (n *LocalDateNode) AsTime() (time.Time, error) + func (n *LocalDateNode) Comment() string + func (n *LocalDateNode) LeadingComments() []string + func (n *LocalDateNode) Raw() []byte + func (n *LocalDateNode) Span() Span + func (n *LocalDateNode) Type() NodeType + func (n *LocalDateNode) Value() any + type LocalDateTime struct + Day int + Hour int + Minute int + Month int + Nanosecond int + Second int + Year int + type LocalDateTimeNode struct + func (n *LocalDateTimeNode) AsBool() (bool, error) + func (n *LocalDateTimeNode) AsFloat() (float64, error) + func (n *LocalDateTimeNode) AsInt() (int64, error) + func (n *LocalDateTimeNode) AsLocalDate() (LocalDate, error) + func (n *LocalDateTimeNode) AsLocalDateTime() (LocalDateTime, error) + func (n *LocalDateTimeNode) AsLocalTime() (LocalTime, error) + func (n *LocalDateTimeNode) AsString() (string, error) + func (n *LocalDateTimeNode) AsTime() (time.Time, error) + func (n *LocalDateTimeNode) Comment() string + func (n *LocalDateTimeNode) LeadingComments() []string + func (n *LocalDateTimeNode) Raw() []byte + func (n *LocalDateTimeNode) Span() Span + func (n *LocalDateTimeNode) Type() NodeType + func (n *LocalDateTimeNode) Value() any + type LocalTime struct + Hour int + Minute int + Nanosecond int + Second int + type LocalTimeNode struct + func (n *LocalTimeNode) AsBool() (bool, error) + func (n *LocalTimeNode) AsFloat() (float64, error) + func (n *LocalTimeNode) AsInt() (int64, error) + func (n *LocalTimeNode) AsLocalDate() (LocalDate, error) + func (n *LocalTimeNode) AsLocalDateTime() (LocalDateTime, error) + func (n *LocalTimeNode) AsLocalTime() (LocalTime, error) + func (n *LocalTimeNode) AsString() (string, error) + func (n *LocalTimeNode) AsTime() (time.Time, error) + func (n *LocalTimeNode) Comment() string + func (n *LocalTimeNode) LeadingComments() []string + func (n *LocalTimeNode) Raw() []byte + func (n *LocalTimeNode) Span() Span + func (n *LocalTimeNode) Type() NodeType + func (n *LocalTimeNode) Value() any + type Node interface + Comment func() string + LeadingComments func() []string + Raw func() []byte + Span func() Span + Type func() NodeType + type NodeType int + const NodeArray + const NodeArrayTable + const NodeBoolean + const NodeComment + const NodeDateTime + const NodeDocument + const NodeFloat + const NodeInlineTable + const NodeInteger + const NodeKey + const NodeKeyValue + const NodeLocalDate + const NodeLocalDateTime + const NodeLocalTime + const NodeString + const NodeTable + func (n NodeType) String() string + type Pair struct + Key string + Value any + type PathSegment struct + Index int + Key string + Kind SegmentKind + func ParsePath(path string) ([]PathSegment, error) + type Position struct + Column int + Line int + Offset int + func (p Position) IsValid() bool + type Record struct + func (r *Record) Entries() iter.Seq[Entry] + func (r *Record) Get(key string) (Entry, bool) + func (r *Record) Len() int + func (r *Record) Node() (Node, bool) + func (r *Record) Span() Span + type Scalar interface + AsBool func() (bool, error) + AsFloat func() (float64, error) + AsInt func() (int64, error) + AsLocalDate func() (LocalDate, error) + AsLocalDateTime func() (LocalDateTime, error) + AsLocalTime func() (LocalTime, error) + AsString func() (string, error) + AsTime func() (time.Time, error) + Value func() any + type SegmentKind int + const SegmentIndex + const SegmentKey + type Span struct + End Position + Start Position + func (s Span) IsValid() bool + type Spec struct + Dynamic *Field + Fields map[string]Field + type StringNode struct + func (n *StringNode) AsBool() (bool, error) + func (n *StringNode) AsFloat() (float64, error) + func (n *StringNode) AsInt() (int64, error) + func (n *StringNode) AsLocalDate() (LocalDate, error) + func (n *StringNode) AsLocalDateTime() (LocalDateTime, error) + func (n *StringNode) AsLocalTime() (LocalTime, error) + func (n *StringNode) AsString() (string, error) + func (n *StringNode) AsTime() (time.Time, error) + func (n *StringNode) Comment() string + func (n *StringNode) LeadingComments() []string + func (n *StringNode) Raw() []byte + func (n *StringNode) Span() Span + func (n *StringNode) Style() StringStyle + func (n *StringNode) Type() NodeType + func (n *StringNode) Value() any + type StringStyle int + const StringBasic + const StringLiteral + const StringMultiLineBasic + const StringMultiLineLiteral + type TableNode struct + func (n *TableNode) Children() []Node + func (n *TableNode) Comment() string + func (n *TableNode) KeyPath() []string + func (n *TableNode) LeadingComments() []string + func (n *TableNode) Raw() []byte + func (n *TableNode) Span() Span + func (n *TableNode) Type() NodeType + type WalkMode int + const WalkAll + const WalkLeaves