persistence

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PRStateSnapshot

type PRStateSnapshot struct {
	URL               string                     `json:"url"`
	Number            int                        `json:"number"`
	Repository        string                     `json:"repository"`
	Author            string                     `json:"author"`
	Title             string                     `json:"title"`
	IsDraft           bool                       `json:"isDraft"`
	CreatedAt         time.Time                  `json:"createdAt"`
	HeadCommitSHA     string                     `json:"headCommitSHA,omitempty"`
	PipelineStatus    pullrequest.PipelineStatus `json:"pipelineStatus"`
	LastActivityCheck time.Time                  `json:"lastActivityCheck"`
	Reviews           map[string]ReviewSnapshot  `json:"reviews"`
	Seen              bool                       `json:"seen"`
}

PRStateSnapshot is a serializable representation of the mutable state of an open pull request. It is used to persist and restore state across process restarts so that the application behaves correctly without re-querying GitHub for information it already knew.

Activities are intentionally excluded: they are always re-fetched from the GitHub API using LastActivityCheck as the fetch window.

func ToSnapshot

func ToSnapshot(pr *pullrequest.PullRequest) PRStateSnapshot

ToSnapshot exports the current mutable state of the PR into a serializable form. The resulting snapshot can be persisted and later passed to ReconstitutePRFromSnapshot to rebuild the aggregate without re-fetching from GitHub.

func ToSnapshots

func ToSnapshots(prs []*pullrequest.PullRequest) []PRStateSnapshot

func (PRStateSnapshot) ReconstitutePRFromSnapshot

func (s PRStateSnapshot) ReconstitutePRFromSnapshot() (*pullrequest.PullRequest, error)

ReconstitutePRFromSnapshot rebuilds a PullRequest aggregate from a previously saved snapshot. Unlike NewPullRequest, this function restores all fields directly without raising domain events — it is restoring known state, not discovering new facts.

Only open PRs are ever persisted to a snapshot; closed and merged PRs are removed from the tracking repository before saving. Status is therefore always StatusOpen on reconstitution.

type ReviewSnapshot

type ReviewSnapshot struct {
	State       pullrequest.ReviewState `json:"state"`
	SubmittedAt time.Time               `json:"submittedAt"`
}

ReviewSnapshot is a serializable representation of a single reviewer's latest review state on a pull request.

Directories

Path Synopsis
Package json provides a JSON-file-backed implementation of the pullrequest.PRTrackingRepository port.
Package json provides a JSON-file-backed implementation of the pullrequest.PRTrackingRepository port.

Jump to

Keyboard shortcuts

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