Files
herolib/lib/data/atlas/export.v
2025-10-16 10:12:02 +04:00

38 lines
838 B
V

module atlas
import incubaid.herolib.core.pathlib
@[params]
pub struct ExportArgs {
pub mut:
destination string
reset bool = true
include bool = true // process includes during export
redis bool = true
}
// Export all collections
pub fn (mut a Atlas) export(args ExportArgs) ! {
mut dest := pathlib.get_dir(path: args.destination, create: true)!
if args.reset {
dest.empty()!
}
// Validate links before export
a.validate_links()!
for _, mut col in a.collections {
col.export(
destination: dest
reset: args.reset
include: args.include
redis: args.redis
)!
// Print errors for this collection if any
if col.has_errors() {
col.print_errors()
}
}
}