doctor

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package doctor runs read-only integrity checks against a remindb store and applies opt-in fixes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Name string
	Run  func(ctx context.Context, st *store.Store) Result
	Fix  func(ctx context.Context, st *store.Store) error
}

func AllChecks

func AllChecks() []Check

AllChecks returns the canonical, ordered set of doctor checks.

type CheckReport

type CheckReport struct {
	Name       string `json:"name"`
	Status     string `json:"status"`
	Detail     string `json:"detail"`
	FixApplied bool   `json:"fix_applied,omitempty"`
	FixError   string `json:"fix_error,omitempty"`
}

type Report

type Report struct {
	Checks []CheckReport `json:"checks"`
}

func Heal

func Heal(ctx context.Context, st *store.Store) Report

Run every check, then apply the registered fix for each failed check whose Check has a non-nil Fix.

func Run

func Run(ctx context.Context, st *store.Store) Report

Run every check, read-only.

func (Report) HasFailures

func (r Report) HasFailures() bool

func (Report) MarshalJSON added in v0.3.4

func (r Report) MarshalJSON() ([]byte, error)

Emit the overall worst-wins status header alongside the per-check list.

func (Report) Status added in v0.3.3

func (r Report) Status() Status

Worst-wins overall status across every check.

func (Report) WriteJSON

func (r Report) WriteJSON(w io.Writer) error

func (Report) WriteText

func (r Report) WriteText(w io.Writer, color bool) error

type Result

type Result struct {
	Status Status
	Detail string
}

type Status

type Status int
const (
	Pass Status = iota
	Warn
	Fail
)

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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