NyaruInsertBatch

public final class NyaruInsertBatch<T> where T : Decodable, T : Encodable, T : Sendable

A write buffer that accumulates document insertions for a single batch flush.

Obtain one via NyaruCollection.insertBatch(_:). All insertions are synchronous — no await needed. Documents are not written to disk until the insertBatch body completes without throwing.

Note

Deliberately not Sendable — the buffer is unsynchronised and must only be used from the insertBatch body that received it.
  • Adds a single document to the batch buffer.

    Declaration

    Swift

    public func insert(_ document: T)
  • Adds a collection of documents to the batch buffer.

    Declaration

    Swift

    public func insert(contentsOf documents: some Collection<T>)