From 8bc7cf02a56788d7bcd6c6374c6152cd93915afd Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 6 Aug 2016 18:13:19 -0700 Subject: [PATCH] Making optional elements nullable --- jmdict.go | 8 ++++---- jmnedict.go | 2 +- kanjidic.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jmdict.go b/jmdict.go index 193049e..5207374 100644 --- a/jmdict.go +++ b/jmdict.go @@ -142,13 +142,13 @@ type JmdictSource struct { // a loanword is drawn. It will be coded using the three-letter language // code from the ISO 639-2 standard. When absent, the value "eng" (i.e. // English) is the default value. The bibliographic (B) codes are used. - Language string `xml:"lang,attr"` + Language *string `xml:"lang,attr"` // The ls_type attribute indicates whether the lsource element // fully or partially describes the source word or phrase of the // loanword. If absent, it will have the implied value of "full". // Otherwise it will contain "part". - Type string `xml:"ls_type,attr"` + Type *string `xml:"ls_type,attr"` // The ls_wasei attribute indicates that the Japanese word // has been constructed from words in the source language, and @@ -164,12 +164,12 @@ type JmdictGlossary struct { // gloss. It will be coded using the three-letter language code from // the ISO 639 standard. When absent, the value "eng" (i.e. English) // is the default value. - Language string `xml:"lang,attr"` + Language *string `xml:"lang,attr"` // The g_gend attribute defines the gender of the gloss (typically // a noun in the target language. When absent, the gender is either // not relevant or has yet to be provided. - Gender string `xml:"g_gend"` + Gender *string `xml:"g_gend"` } type JmdictSense struct { diff --git a/jmnedict.go b/jmnedict.go index 8648281..151cd8f 100644 --- a/jmnedict.go +++ b/jmnedict.go @@ -127,7 +127,7 @@ type JmnedictTranslation struct { // code from the ISO 639-2 standard. When absent, the value "eng" // (i.e. English) is the default value. The bibliographic (B) codes // are used. - Language string `xml:"lang,attr"` + Language *string `xml:"lang,attr"` } func LoadJmnedict(reader io.Reader) (Jmnedict, map[string]string, error) { diff --git a/kanjidic.go b/kanjidic.go index 4ff9770..efdbdae 100644 --- a/kanjidic.go +++ b/kanjidic.go @@ -311,7 +311,7 @@ type KanjidicMeaning struct { // The m_lang attribute defines the target language of the meaning. It // will be coded using the two-letter language code from the ISO 639-1 // standard. When absent, the value "en" (i.e. English) is implied. [{}] - Language string `xml:"m_lang,attr"` + Language *string `xml:"m_lang,attr"` } func LoadKanjidic(reader io.Reader) (Kanjidic, error) {