versioning

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileVersion

type FileVersion struct {
	ProtoPath   string    // Path to proto file
	Version     string    // Version identifier
	Hash        string    // Content hash
	Timestamp   time.Time // Creation time
	OutputPath  string    // Path to generated output
	GeneratedAt time.Time // When it was generated
}

FileVersion represents a versioned file

type Manager

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

Manager manages file versioning

func New

func New(opts Options) *Manager

New creates a new versioning manager

func (*Manager) CleanupOldVersions

func (m *Manager) CleanupOldVersions(outputDir string) error

CleanupOldVersions removes old versions keeping only the latest N versions

func (*Manager) ComputeHash

func (m *Manager) ComputeHash(filePath string) (string, error)

ComputeHash computes SHA256 hash of a file

func (*Manager) GenerateVersion

func (m *Manager) GenerateVersion(protoPath string) (string, error)

GenerateVersion generates a new version identifier

func (*Manager) GetCurrentVersion

func (m *Manager) GetCurrentVersion(protoPath, language string) (*FileVersion, error)

GetCurrentVersion gets the current version for a proto file and language

func (*Manager) GetVersionedOutputPath

func (m *Manager) GetVersionedOutputPath(baseOutputPath, version string) string

GetVersionedOutputPath returns the output path with version

func (*Manager) IsEnabled

func (m *Manager) IsEnabled() bool

IsEnabled returns true if versioning is enabled

func (*Manager) SaveVersion

func (m *Manager) SaveVersion(protoPath, language, version string, outputPath string) error

SaveVersion saves version information for a proto file and language

func (*Manager) ShouldGenerateNewVersion

func (m *Manager) ShouldGenerateNewVersion(protoPath, language string) (bool, error)

ShouldGenerateNewVersion checks if a new version should be generated for a proto file and language

type Options

type Options struct {
	Enabled      bool
	Strategy     Strategy
	OutputFormat OutputFormat
	KeepVersions int
	StateDir     string
}

Options contains versioning options

type OutputFormat

type OutputFormat string

OutputFormat represents how versioned files are organized

const (
	FormatDirectory OutputFormat = "directory" // Create version directories (v1/, v2/)
	FormatSuffix    OutputFormat = "suffix"    // Add version suffix (_v1, _v2)
)

type Strategy

type Strategy string

Strategy represents versioning strategy

const (
	StrategyHash      Strategy = "hash"      // Use content hash as version
	StrategyTimestamp Strategy = "timestamp" // Use timestamp as version
	StrategySemantic  Strategy = "semantic"  // Use semantic versioning (v1, v2, v3)
	StrategyGit       Strategy = "git"       // Use git commit hash
)

Jump to

Keyboard shortcuts

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