-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Batch/Backup commands use SchemaFlag (#570)
This will allow the programs to configure what tables are build with lax schema. Defaults to strict. Fixes #564
- Loading branch information
Showing
5 changed files
with
48 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// SchemaFlag.swift | ||
// itunes_json | ||
// | ||
// Created by Greg Bolsinga on 12/25/24. | ||
// | ||
|
||
import ArgumentParser | ||
import Foundation | ||
|
||
enum SchemaFlag: String, EnumerableFlag { | ||
case artists, albums, songs, plays | ||
} | ||
|
||
extension SchemaFlag { | ||
var schemaOption: SchemaOptions { | ||
switch self { | ||
case .artists: | ||
.laxArtist | ||
case .albums: | ||
.laxAlbum | ||
case .songs: | ||
.laxSong | ||
case .plays: | ||
.laxPlays | ||
} | ||
} | ||
} | ||
|
||
extension Collection where Element == SchemaFlag { | ||
var schemaOptions: SchemaOptions { | ||
self.reduce(into: SchemaOptions()) { partialResult, flag in | ||
partialResult.insert(flag.schemaOption) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters