1
Fork 0

Simplify logic for `index.json` struct

This commit is contained in:
stephenmk 2023-01-28 18:39:08 -06:00
parent 184dd45dbc
commit abbe183145
No known key found for this signature in database
GPG Key ID: B6DA730DB06235F1
8 changed files with 10 additions and 24 deletions

View File

@ -214,6 +214,7 @@ func writeDb(outputPath string, index dbIndex, recordData map[string]dbRecordLis
}
}
index.setDefaults()
bytes, err := marshalJSON(index, pretty)
if err != nil {
return err

View File

@ -105,10 +105,8 @@ func jmnedictExportDb(inputPath, outputPath, language, title string, stride int,
Title: title,
Revision: "jmnedict1",
Sequenced: true,
Description: "",
Attribution: edrdgAttribution,
}
index.setDefaults()
return writeDb(
outputPath,

View File

@ -102,13 +102,10 @@ func epwingExportDb(inputPath, outputPath, language, title string, stride int, p
}
index := dbIndex{
Title: title,
Revision: strings.Join(revisions, ";"),
Sequenced: true,
Description: "",
Attribution: "",
Title: title,
Revision: strings.Join(revisions, ";"),
Sequenced: true,
}
index.setDefaults()
return writeDb(
outputPath,

View File

@ -56,13 +56,10 @@ func frequncyExportDb(inputPath, outputPath, language, title string, stride int,
}
index := dbIndex{
Title: title,
Revision: "frequency1",
Sequenced: false,
Description: "",
Attribution: "",
Title: title,
Revision: "frequency1",
Sequenced: false,
}
index.setDefaults()
return writeDb(
outputPath,

View File

@ -238,7 +238,6 @@ func jmdExportDb(inputPath string, outputPath string, languageName string, title
Sequenced: true,
Attribution: edrdgAttribution,
}
index.setDefaults()
return writeDb(
outputPath,

View File

@ -254,7 +254,6 @@ func formsExportDb(inputPath, outputPath, languageName, title string, stride int
Sequenced: true,
Attribution: edrdgAttribution,
}
index.setDefaults()
return writeDb(
outputPath,

View File

@ -163,10 +163,8 @@ func kanjidicExportDb(inputPath, outputPath, language, title string, stride int,
Title: title,
Revision: "kanjidic2",
Sequenced: false,
Description: "",
Attribution: edrdgAttribution,
}
index.setDefaults()
return writeDb(
outputPath,

View File

@ -153,13 +153,10 @@ func rikaiExportDb(inputPath, outputPath, language, title string, stride int, pr
}
index := dbIndex{
Title: title,
Revision: "rikai2",
Sequenced: true,
Description: "",
Attribution: "",
Title: title,
Revision: "rikai2",
Sequenced: true,
}
index.setDefaults()
return writeDb(
outputPath,