Documentation
¶
Overview ¶
Package archive 提供 OFD 文档的档案预检、清单和归档准备辅助功能。 它不会修改源 OFD,也不宣称文档符合法律或合规要求。
Index ¶
- Constants
- func BuildManifest(ctx context.Context, input string, metadata Metadata, profile string, ...) (Manifest, Report, error)
- func RenderJSON(writer io.Writer, report any, pretty bool) error
- func RenderMarkdown(writer io.Writer, report Report) error
- func RenderMatrixMarkdown(writer io.Writer, matrix MatrixReport) error
- func RenderMatrixXLSX(writer io.Writer, matrix MatrixReport) error
- func RenderText(writer io.Writer, report Report) error
- type Attachment
- type FeatureSummary
- type FileInfo
- type Issue
- type Manifest
- type MatrixClause
- type MatrixReport
- type MatrixSummary
- type Metadata
- type Options
- type Profile
- type Report
- type ToolInfo
Constants ¶
View Source
const ( SchemaVersion = "1" ToolVersion = "0.0.1" StatusPassed = "passed" StatusWarning = "warning" StatusFailed = "failed" StatusNotAssessed = "not_assessed" StatusUnsupported = "unsupported" )
View Source
const ( MatrixSchemaVersion = "1" MatrixStandard = "GB/T 42133-2022" MatrixPassed = "passed" MatrixFailed = "failed" MatrixWarning = "warning" MatrixManualReview = "manual_review" MatrixNotApplicable = "not_applicable" MatrixNotAssessed = "not_assessed" MatrixUnsupported = "unsupported" )
Variables ¶
This section is empty.
Functions ¶
func BuildManifest ¶
func BuildManifest(ctx context.Context, input string, metadata Metadata, profile string, options Options) (Manifest, Report, error)
BuildManifest 创建技术和档案清单,且不会修改输入文件。
func RenderMarkdown ¶
RenderMarkdown 将归档预检报告输出为 Markdown。
func RenderMatrixMarkdown ¶
func RenderMatrixMarkdown(writer io.Writer, matrix MatrixReport) error
RenderMatrixMarkdown 将完整矩阵渲染为便于人工审阅的 Markdown。
func RenderMatrixXLSX ¶
func RenderMatrixXLSX(writer io.Writer, matrix MatrixReport) error
RenderMatrixXLSX 将条文矩阵写入 Office Open XML 工作簿。
Types ¶
type Attachment ¶
type Attachment struct {
DocumentIndex int `json:"document_index"`
ID string `json:"id"`
Name string `json:"name"`
Format string `json:"format,omitempty"`
SourcePath string `json:"source_path"`
ArchivePath string `json:"archive_path,omitempty"`
Size uint64 `json:"size,omitempty"`
SHA256 string `json:"sha256,omitempty"`
Exists bool `json:"exists"`
Copied bool `json:"copied"`
Conversion string `json:"conversion,omitempty"`
}
type FeatureSummary ¶
type Issue ¶
type Issue struct {
Severity string `json:"severity"`
Code string `json:"code"`
Message string `json:"message"`
Hint string `json:"hint,omitempty"`
Path string `json:"path,omitempty"`
}
func VerifyFixity ¶
VerifyFixity 根据归档根目录中的普通文件校验 fixity/manifest.sha256。
type Manifest ¶
type Manifest struct {
SchemaVersion string `json:"schema_version"`
Tool ToolInfo `json:"tool"`
CreatedAt time.Time `json:"created_at"`
Source FileInfo `json:"source"`
Metadata Metadata `json:"metadata"`
Profile string `json:"profile,omitempty"`
Report string `json:"report"`
Analysis string `json:"analysis"`
Fixity string `json:"fixity"`
Attachments []Attachment `json:"attachments"`
Files []FileInfo `json:"files"`
}
type MatrixClause ¶
type MatrixClause struct {
ID string `json:"clause"`
Title string `json:"title"`
Requirement string `json:"requirement"`
Applicability string `json:"applicability"`
Status string `json:"status"`
Assessment string `json:"assessment"`
Evidence []string `json:"evidence,omitempty"`
Detector string `json:"detector,omitempty"`
ManualReview bool `json:"manual_review,omitempty"`
Limitations string `json:"limitations,omitempty"`
}
MatrixClause 表示条文级符合性矩阵中的一行。
type MatrixReport ¶
type MatrixReport struct {
SchemaVersion string `json:"schema_version"`
Standard string `json:"standard"`
Source string `json:"source"`
GeneratedAt time.Time `json:"generated_at"`
Input FileInfo `json:"input"`
OverallStatus string `json:"overall_status"`
Summary MatrixSummary `json:"summary"`
Clauses []MatrixClause `json:"clauses"`
Preflight Report `json:"preflight"`
}
MatrixReport 包含针对指定整理版条款目录生成的完整矩阵。 它是评估辅助工具,不构成法律或认证结论。
func BuildMatrix ¶
BuildMatrix 执行技术预检,并评估指定整理版条款目录中的每一条条款。 没有客观检测器的条款保持为 manual_review,而不是 passed。
type MatrixSummary ¶
type Metadata ¶
type Metadata struct {
ArchiveCode string `json:"archive_code" yaml:"archive_code"`
FondsCode string `json:"fonds_code" yaml:"fonds_code"`
RetentionPeriod string `json:"retention_period" yaml:"retention_period"`
SecurityClassification string `json:"security_classification" yaml:"security_classification"`
OpenStatus string `json:"open_status" yaml:"open_status"`
}
func LoadMetadata ¶
LoadMetadata 从 JSON、YAML 或类 YAML 文件中加载档案描述元数据。
type Options ¶
type Options struct {
ValidatorOptions []validator.Option
AnalyzerOptions []analyzer.Option
FailOnWarning bool
HashAlgorithm string
MaxAttachmentSize int64
MaxXMLBytes int64
}
func DefaultOptions ¶
func DefaultOptions() Options
type Report ¶
type Report struct {
SchemaVersion string `json:"schema_version"`
Tool ToolInfo `json:"tool"`
Input FileInfo `json:"input"`
Status string `json:"status"`
StartedAt time.Time `json:"started_at"`
DurationMS int64 `json:"duration_ms"`
Issues []Issue `json:"issues"`
Features FeatureSummary `json:"features"`
Attachments []Attachment `json:"attachments"`
ValidatorReport validator.Report `json:"validator_report"`
AnalysisReport analyzer.Report `json:"analysis_report"`
}
Click to show internal directories.
Click to hide internal directories.