1

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) bytes, err := marshalJSON(index, pretty)
if err != nil { if err != nil {
return err return err

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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