schemaver

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package schemaver stamps and verifies a persistence schema version inside each service's bbolt database. Every store writes plain JSON structs into bbolt buckets; without a version marker, loading data written by a different binary could silently corrupt (a renamed or semantically-changed field deserializes into the wrong shape). Ensure records the current version on first use and, on later opens, refuses a database written by a newer schema rather than misread it.

Index

Constants

View Source
const Current uint32 = 1

Current is the schema version every store writes today. Bump it (and add a migration in Ensure) when a persisted struct changes incompatibly.

Variables

This section is empty.

Functions

func Ensure

func Ensure(db *bolt.DB, service string, current uint32) error

Ensure verifies (or, on a fresh/pre-versioning database, stamps) the schema version. service names the store for error messages. An unversioned database is treated as Current and stamped in place (existing data is v1). A database written by a newer schema is rejected — refusing to load is safer than silently misinterpreting fields.

Types

This section is empty.

Jump to

Keyboard shortcuts

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