export

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractTarGz added in v1.5.4

func ExtractTarGz(archivePath, destDir string) error

Types

type Analyzer

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

Analyzer handles analyzing backup files

func NewAnalyzer

func NewAnalyzer(db *gorm.DB, dataDir string) *Analyzer

NewAnalyzer creates a new analyzer instance

func (*Analyzer) AnalyzeBackup

func (a *Analyzer) AnalyzeBackup(archivePath string) (*BackupAnalysis, error)

AnalyzeBackup analyzes a backup file and returns metadata without restoring

type BackupAnalysis

type BackupAnalysis struct {
	Valid           bool     `json:"valid"`
	AviaryVersion   string   `json:"aviary_version"`
	GitCommit       string   `json:"git_commit"`
	ExportTimestamp string   `json:"export_timestamp"`
	DatabaseType    string   `json:"database_type"`
	UserCount       int      `json:"user_count"`
	APIKeyCount     int      `json:"api_key_count"`
	DocumentCount   int64    `json:"document_count"`
	TotalSizeBytes  int64    `json:"total_size_bytes"`
	ExportedTables  []string `json:"exported_tables"`
	UsersExported   []string `json:"users_exported"`
	Errors          []string `json:"errors,omitempty"`
	Warnings        []string `json:"warnings,omitempty"`
	ExtractionPath  string   `json:"extraction_path,omitempty"` // Path if already extracted during analysis
}

BackupAnalysis contains the results of analyzing a backup file

type ExportMetadata

type ExportMetadata struct {
	AviaryVersion   string    `json:"aviary_version"`
	GitCommit       string    `json:"git_commit"`
	ExportTimestamp time.Time `json:"export_timestamp"`
	DatabaseType    string    `json:"database_type"`
	UsersExported   []string  `json:"users_exported"`
	TotalDocuments  int64     `json:"total_documents"`
	TotalSizeBytes  int64     `json:"total_size_bytes"`
	ExportedTables  []string  `json:"exported_tables"`
	TotalUsers      int       `json:"total_users"`    // Total number of users in backup
	TotalAPIKeys    int       `json:"total_api_keys"` // Total number of API keys in backup
}

ExportMetadata contains information about the export

type ExportOptions

type ExportOptions struct {
	IncludeDatabase bool
	IncludeFiles    bool
	IncludeConfigs  bool
	UserIDs         []uuid.UUID // If specified, only export these users
}

ExportOptions configures what to include in the export

type Exporter

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

Exporter handles creating complete backups

func NewExporter

func NewExporter(db *gorm.DB, dataDir string) *Exporter

NewExporter creates a new exporter instance

func (*Exporter) Export

func (e *Exporter) Export(outputPath string, options ExportOptions) error

Export creates a complete backup archive

type ImportOptions

type ImportOptions struct {
	OverwriteFiles    bool
	OverwriteDatabase bool
	UserIDs           []uuid.UUID // If specified, only import these users
}

ImportOptions configures how to handle the import

type Importer

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

Importer handles restoring from backup archives

func NewImporter

func NewImporter(db *gorm.DB, dataDir string) *Importer

NewImporter creates a new importer instance

func (*Importer) Import

func (i *Importer) Import(archivePath string, options ImportOptions) (*ExportMetadata, error)

Import restores from a backup archive

func (*Importer) ImportFromExtractedDirectory added in v1.5.4

func (i *Importer) ImportFromExtractedDirectory(extractedDir string, options ImportOptions) (*ExportMetadata, error)

ImportFromExtractedDirectory imports from an already-extracted directory

Jump to

Keyboard shortcuts

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