stability

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package stability provides an API to validate the stability of persisted data structures. The only exported type is SerializedValue, that must be included data structures for persistence.

It checks that code change in data structures does not impact backward-compatibility.

Example
package main

import "github.com/TroutSoftware/sqlite/stability"

type User struct {
	_ stability.SerializedValue

	Name string
	Age  int
}

func main() {
	// empty function, the User structure matters.
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var Changes = &analysis.Analyzer{
	Name:       "changed",
	Doc:        "Use VCS to know which lines have changed",
	Run:        run_commitdiffs,
	ResultType: reflect.TypeOf([]Hunk{}),
}
View Source
var ExplicitSerialized = &analysis.Analyzer{
	Name:     "serialized",
	Doc:      `Find data structures that are marked as being serialized`,
	Requires: []*analysis.Analyzer{inspect.Analyzer, Changes},
	Run:      run_collectStructs,
}

Functions

This section is empty.

Types

type Hunk

type Hunk struct {
	Filename string
	Edits    []int // odd for start, even for end
}

type SerializedValue

type SerializedValue struct{}

SerializedValue should be the first anonymous member of a data structure that is serialized (see example). Data structures marked as such can be passed to SQLite for persistence.

Jump to

Keyboard shortcuts

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