version

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// Save 保存当前配置为新版本
	Save(description string) (string, error)
	// Rollback 回滚到指定版本
	Rollback(versionID string) error
	// List 列出所有版本
	List() ([]*Version, error)
	// Get 获取指定版本
	Get(versionID string) (*Version, error)
	// Compare 比较两个版本
	Compare(versionID1, versionID2 string) (map[string]interface{}, error)
}

Manager 是配置版本管理器接口

func New

func New(cfg config.Config, opts ...Option) Manager

New 创建一个版本管理器

type Option

type Option func(*options)

Option 是版本管理器选项函数

func WithMaxVersions

func WithMaxVersions(max int) Option

WithMaxVersions 设置最大版本数

type Version

type Version struct {
	// ID 是版本ID
	ID string
	// Timestamp 是版本时间戳
	Timestamp time.Time
	// Description 是版本描述
	Description string
	// Data 是版本数据
	Data map[string]interface{}
}

Version 是配置版本

Jump to

Keyboard shortcuts

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