diff

package
v2.0.59 Latest Latest
Warning

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

Go to latest
Published: May 9, 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 DiffLevel

type DiffLevel int
const (
	LevelInfo DiffLevel = iota
	LevelWarn
	LevelError
)

type DiffRecord

type DiffRecord struct {
	FieldPath string // 结构体字段路径(如 "Basic.ID")
	FieldDesc string // 字段描述(如 "基础信息.用户ID")
	OldValue  any
	NewValue  any
	Level     DiffLevel
}

func Compare

func Compare(a, b any, opts ...*Options) []DiffRecord

增强版对比入口

type Options

type Options struct {
	IgnoreFields map[string]bool      // 忽略字段路径
	FieldLevels  map[string]DiffLevel // 字段级别映射
}

Jump to

Keyboard shortcuts

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