diff --git a/CNJ/cnj.go b/CNJ/cnj.go index 15944a4..19ffa51 100644 --- a/CNJ/cnj.go +++ b/CNJ/cnj.go @@ -22,6 +22,7 @@ type AnalysisCNJ struct { } //DecomposedCNJ returns the CNJ in decomposed manner: +// lawsuitCNJFormat [NNNNNNN]-[DD].[AAAA].[J].[CT].[0000] // lawsuitNumber: [NNNNNNN] // verifyingDigit: [DD] // protocolYear: [AAAA] @@ -32,15 +33,16 @@ type AnalysisCNJ struct { // district: district where the lawsuit was proposed, frequently a city name // uf: the uf of the correspondent district type DecomposedCNJ struct { - LawsuitNumber string `json:"lawsuit_number,omitempty"` - VerifyingDigit string `json:"verifying_digit,omitempty"` - ProtocolYear string `json:"protocol_year,omitempty"` - Segment string `json:"segment,omitempty"` - Court string `json:"court,omitempty"` - SourceUnit string `json:"source_unit,omitempty"` - ArgNumber string `json:"arg_number,omitempty"` - District string `json:"district,omitempty"` - UF string `json:"UF,omitempty"` + LawsuitCNJFormat string `json:"lawsuitCNJFormat,omitempty"` + LawsuitNumber string `json:"lawsuit_number,omitempty"` + VerifyingDigit string `json:"verifying_digit,omitempty"` + ProtocolYear string `json:"protocol_year,omitempty"` + Segment string `json:"segment,omitempty"` + Court string `json:"court,omitempty"` + SourceUnit string `json:"source_unit,omitempty"` + ArgNumber string `json:"arg_number,omitempty"` + District string `json:"district,omitempty"` + UF string `json:"UF,omitempty"` } //AnalyzeCNJ returns the complex struct AnalysisCNJ containing all the useful data from this package diff --git a/CNJ/decomposer.go b/CNJ/decomposer.go index 0723246..72bb701 100644 --- a/CNJ/decomposer.go +++ b/CNJ/decomposer.go @@ -9,7 +9,7 @@ import ( const MATH = "00" // DecomposeCNJ decompose cnj format number into the specifics: -// NNNNNNN-DD.AAAA.J.TR.OOOO +// lawsuitCNJFormat [NNNNNNN]-[DD].[AAAA].[J].[CT].[0000] // LawsuitNumber = [NNNNNNN] // VerifyingDigit = [DD] // ProtocolYear = [AAAA] @@ -42,28 +42,30 @@ func DecomposeCNJ(cnj string) (DecomposedCNJ, error) { dt, err := CNJDatabase.FetchDistrict(semiCNJ) if err != nil { return DecomposedCNJ{ - LawsuitNumber: lawsuitNumber, - VerifyingDigit: verifyingDigit, - ProtocolYear: yearProtocol, - Segment: segment, - Court: court, - SourceUnit: sourceUnit, - ArgNumber: argNumber, - District: err.Error(), - UF: err.Error(), + LawsuitCNJFormat: lawsuitNumber + "-" + verifyingDigit + "." + yearProtocol + "." + segment + "." + court + "." + sourceUnit, + LawsuitNumber: lawsuitNumber, + VerifyingDigit: verifyingDigit, + ProtocolYear: yearProtocol, + Segment: segment, + Court: court, + SourceUnit: sourceUnit, + ArgNumber: argNumber, + District: err.Error(), + UF: err.Error(), }, err } return DecomposedCNJ{ - LawsuitNumber: lawsuitNumber, - VerifyingDigit: verifyingDigit, - ProtocolYear: yearProtocol, - Segment: segment, - Court: court, - SourceUnit: sourceUnit, - ArgNumber: argNumber, - District: dt.SourceUnit, - UF: dt.UF, + LawsuitCNJFormat: lawsuitNumber + "-" + verifyingDigit + "." + yearProtocol + "." + segment + "." + court + "." + sourceUnit, + LawsuitNumber: lawsuitNumber, + VerifyingDigit: verifyingDigit, + ProtocolYear: yearProtocol, + Segment: segment, + Court: court, + SourceUnit: sourceUnit, + ArgNumber: argNumber, + District: dt.SourceUnit, + UF: dt.UF, }, nil } else { lawsuitNumber := cnj[0:7] @@ -88,29 +90,31 @@ func DecomposeCNJ(cnj string) (DecomposedCNJ, error) { if err != nil { if err != nil { return DecomposedCNJ{ - LawsuitNumber: lawsuitNumber, - VerifyingDigit: verifyingDigit, - ProtocolYear: yearProtocol, - Segment: segment, - Court: court, - SourceUnit: sourceUnit, - ArgNumber: argNumber, - District: err.Error(), - UF: err.Error(), + LawsuitCNJFormat: lawsuitNumber + "-" + verifyingDigit + "." + yearProtocol + "." + segment + "." + court + "." + sourceUnit, + LawsuitNumber: lawsuitNumber, + VerifyingDigit: verifyingDigit, + ProtocolYear: yearProtocol, + Segment: segment, + Court: court, + SourceUnit: sourceUnit, + ArgNumber: argNumber, + District: err.Error(), + UF: err.Error(), }, err } } return DecomposedCNJ{ - LawsuitNumber: lawsuitNumber, - VerifyingDigit: verifyingDigit, - ProtocolYear: yearProtocol, - Segment: segment, - Court: court, - SourceUnit: sourceUnit, - ArgNumber: argNumber, - District: dt.District, - UF: dt.UF, + LawsuitCNJFormat: lawsuitNumber + "-" + verifyingDigit + "." + yearProtocol + "." + segment + "." + court + "." + sourceUnit, + LawsuitNumber: lawsuitNumber, + VerifyingDigit: verifyingDigit, + ProtocolYear: yearProtocol, + Segment: segment, + Court: court, + SourceUnit: sourceUnit, + ArgNumber: argNumber, + District: dt.District, + UF: dt.UF, }, nil }