Documentation
¶
Index ¶
- Constants
- Variables
- func BatchTxItems(v zapv1.View[BatchSchema]) zapv1.List[ItemSchema]
- func NewBatchItem(iD uint64, value uint64) (zapv1.View[ItemSchema], []byte)
- func NewBatchTx(iD uint64, items []Item) (zapv1.View[BatchSchema], []byte)
- func WrapBatchItem(b []byte) (zapv1.View[ItemSchema], error)
- func WrapBatchTx(b []byte) (zapv1.View[BatchSchema], error)
- type BatchSchema
- type Item
- type ItemSchema
Constants ¶
const KindBatchItem zapv1.KindByte = 0x22
KindBatchItem is the wire discriminator for BatchItem.
const KindBatchTx zapv1.KindByte = 0x21
KindBatchTx is the wire discriminator for BatchTx.
const OffsetBatchItem_ID = 0
OffsetBatchItem_ID is the byte offset of the ID field.
const OffsetBatchItem_Value = 8
OffsetBatchItem_Value is the byte offset of the Value field.
const OffsetBatchTx_ID = 1
OffsetBatchTx_ID is the byte offset of the ID field.
const OffsetBatchTx_Items = 9
OffsetBatchTx_Items is the byte offset of the Items field.
const SizeBatchItem = 16
SizeBatchItem is the fixed object payload size in bytes.
const SizeBatchTx = 17
SizeBatchTx is the fixed object payload size in bytes.
Variables ¶
var BatchSchemaFields = struct { ID zapv1.Field[BatchSchema, uint64] }{ ID: zapv1.At[BatchSchema, uint64](1), }
BatchSchemaFields is the namespace of every scalar field accessor for BatchTx. Use with zapv1.Read / zapv1.Write for type-safe access. Byte-array fields are emitted as standalone functions, see below.
var ItemSchemaFields = struct { ID zapv1.Field[ItemSchema, uint64] Value zapv1.Field[ItemSchema, uint64] }{ ID: zapv1.At[ItemSchema, uint64](0), Value: zapv1.At[ItemSchema, uint64](8), }
ItemSchemaFields is the namespace of every scalar field accessor for BatchItem. Use with zapv1.Read / zapv1.Write for type-safe access. Byte-array fields are emitted as standalone functions, see below.
Functions ¶
func BatchTxItems ¶
func BatchTxItems(v zapv1.View[BatchSchema]) zapv1.List[ItemSchema]
BatchTxItems returns the variable-length Items list of BatchTx as a range-over-func-ready zapv1.ListItemSchema. Zero-copy: each element view indexes straight into the underlying buffer.
for it := range BatchTxItems(view).All() {
// zapv1.Read(it, ItemSchemaFields.X)
}
func NewBatchItem ¶
NewBatchItem builds a fresh BatchItem 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 NewBatchTx ¶
NewBatchTx builds a fresh BatchTx 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 WrapBatchItem ¶
func WrapBatchItem(b []byte) (zapv1.View[ItemSchema], error)
WrapBatchItem parses a ZAP buffer into a typed [zapv1.View[BatchItem]]. 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 WrapBatchTx ¶
func WrapBatchTx(b []byte) (zapv1.View[BatchSchema], error)
WrapBatchTx parses a ZAP buffer into a typed [zapv1.View[BatchTx]]. 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 BatchSchema ¶
type BatchSchema struct{}
BatchSchema is the v2 schema marker for BatchTx. Methods are constant- returning so concrete-typed [zapv1.Wrap[BatchSchema]] calls fold to literals at the call site.
func (BatchSchema) Kind ¶
func (BatchSchema) Kind() zapv1.KindByte
func (BatchSchema) Name ¶
func (BatchSchema) Name() string
func (BatchSchema) Size ¶
func (BatchSchema) Size() int
type ItemSchema ¶
type ItemSchema struct{}
ItemSchema is the v2 schema marker for BatchItem. Methods are constant- returning so concrete-typed [zapv1.Wrap[ItemSchema]] calls fold to literals at the call site.
func (ItemSchema) Kind ¶
func (ItemSchema) Kind() zapv1.KindByte
func (ItemSchema) Name ¶
func (ItemSchema) Name() string
func (ItemSchema) Size ¶
func (ItemSchema) Size() int