Help us shape the future of Go! Take the 2026 Go Developer Survey

document

package
v0.19.8 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package document is the durable-document port every layer shares, ai and bridge included; host re-exports it as host.Document for embedders.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Replace

func Replace(ctx context.Context, d Document, data []byte) error

Replace commits data as the whole document; nil deletes it.

Types

type Document

type Document interface {
	Read(context.Context) ([]byte, error)
	Update(context.Context, func([]byte) ([]byte, error)) error
}

Document updates must commit before returning; nil deletes the document.

type Memory

type Memory struct {
	// contains filtered or unexported fields
}

Memory is a Document that lives only as long as the value.

func (*Memory) Read

func (m *Memory) Read(context.Context) ([]byte, error)

func (*Memory) Update

func (m *Memory) Update(_ context.Context, change func([]byte) ([]byte, error)) error

Jump to

Keyboard shortcuts

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