nestwire

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const KindInner zapv1.KindByte = 0x52

KindInner is the wire discriminator for Inner.

View Source
const KindOuter zapv1.KindByte = 0x51

KindOuter is the wire discriminator for Outer.

View Source
const OffsetInner_ID = 0

OffsetInner_ID is the byte offset of the ID field.

View Source
const OffsetInner_Label = 8

OffsetInner_Label is the byte offset of the Label field.

View Source
const OffsetOuter_Inner = 9

OffsetOuter_Inner is the byte offset of the Inner field.

View Source
const OffsetOuter_Seq = 1

OffsetOuter_Seq is the byte offset of the Seq field.

View Source
const SizeInner = 16

SizeInner is the fixed object payload size in bytes.

View Source
const SizeOuter = 13

SizeOuter is the fixed object payload size in bytes.

Variables

View Source
var InnerSchemaFields = struct {
	ID zapv1.Field[InnerSchema, uint64]
}{
	ID: zapv1.At[InnerSchema, uint64](0),
}

InnerSchemaFields is the namespace of every scalar field accessor for Inner. Use with zapv1.Read / zapv1.Write for type-safe access. Byte-array fields are emitted as standalone functions, see below.

View Source
var OuterSchemaFields = struct {
	Seq zapv1.Field[OuterSchema, uint64]
}{
	Seq: zapv1.At[OuterSchema, uint64](1),
}

OuterSchemaFields is the namespace of every scalar field accessor for Outer. Use with zapv1.Read / zapv1.Write for type-safe access. Byte-array fields are emitted as standalone functions, see below.

Functions

func InnerLabel

func InnerLabel(v zapv1.View[InnerSchema]) string

InnerLabel reads the variable-length Label string field of Inner.

Zero-copy: v1's Object.Text returns a string over a sub-slice of the underlying buffer. Valid only while the View's buffer is alive.

func NewInner

func NewInner(iD uint64, label string) (zapv1.View[InnerSchema], []byte)

NewInner builds a fresh Inner in a ZAP buffer.

Hand-rolled fast path: inlines v1 primitives (zap.NewBuilder, [*Builder.StartObject], [*ObjectBuilder.Set*], [*Builder.Finish]) so the entire build expands at the call site. Scalars and fixed byte arrays live in the fixed payload; variable-length string/bytes go in the object tail (the fixed payload holds their 8-byte pointers).

func NewOuter

func NewOuter(seq uint64, inner *Inner) (zapv1.View[OuterSchema], []byte)

NewOuter builds a fresh Outer in a ZAP buffer.

Hand-rolled fast path: inlines v1 primitives (zap.NewBuilder, [*Builder.StartObject], [*ObjectBuilder.Set*], [*Builder.Finish]) so the entire build expands at the call site. Scalars and fixed byte arrays live in the fixed payload; variable-length string/bytes go in the object tail (the fixed payload holds their 8-byte pointers).

func OuterInner

func OuterInner(v zapv1.View[OuterSchema]) zapv1.View[InnerSchema]

OuterInner returns the singular Inner nested object of Outer as a zero-copy zapv1.ViewInnerSchema. An unset (null) nested field yields the zero View — test it with zapv1.View.IsZero.

func WrapInner

func WrapInner(b []byte) (zapv1.View[InnerSchema], error)

WrapInner parses a ZAP buffer into a typed [zapv1.View[Inner]]. Validates the wire frame and the kind discriminator at offset 0; returns *zapv1.SchemaError on kind mismatch.

Hand-rolled fast path: inlines zap.Parse (which is itself inlineable). Zero heap allocs on the happy path; matches v1 hand-rolled performance.

func WrapOuter

func WrapOuter(b []byte) (zapv1.View[OuterSchema], error)

WrapOuter parses a ZAP buffer into a typed [zapv1.View[Outer]]. Validates the wire frame and the kind discriminator at offset 0; returns *zapv1.SchemaError on kind mismatch.

Hand-rolled fast path: inlines zap.Parse (which is itself inlineable). Zero heap allocs on the happy path; matches v1 hand-rolled performance.

Types

type Inner

type Inner struct {
	ID    uint64
	Label string
}

Inner is the value input for the singular Outer.Inner nested object.

type InnerSchema

type InnerSchema struct{}

InnerSchema is the v1 schema marker for Inner. Methods are constant- returning so concrete-typed [zapv1.Wrap[InnerSchema]] calls fold to literals at the call site.

func (InnerSchema) Kind

func (InnerSchema) Kind() zapv1.KindByte

func (InnerSchema) Name

func (InnerSchema) Name() string

func (InnerSchema) Size

func (InnerSchema) Size() int

type OuterSchema

type OuterSchema struct{}

OuterSchema is the v1 schema marker for Outer. Methods are constant- returning so concrete-typed [zapv1.Wrap[OuterSchema]] calls fold to literals at the call site.

func (OuterSchema) Kind

func (OuterSchema) Kind() zapv1.KindByte

func (OuterSchema) Name

func (OuterSchema) Name() string

func (OuterSchema) Size

func (OuterSchema) Size() int

Jump to

Keyboard shortcuts

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