@@ -2,56 +2,18 @@ package definitions
22
33import (
44 _ "embed"
5- "errors"
6- "fmt"
75
86 "github.com/ugorji/go/codec"
97)
108
119var (
10+ //go:embed definitions.json
11+ docBytes []byte
12+
1213 // definitions is the singleton instance of the Definitions struct.
1314 definitions * Definitions
14-
15- // Errors
16-
17- // ErrUnableToCastFieldInfo is returned when the field info cannot be cast.
18- ErrUnableToCastFieldInfo = errors .New ("unable to cast to field info" )
1915)
2016
21- //go:embed definitions.json
22- var docBytes []byte
23-
24- func Get () * Definitions {
25- return definitions
26- }
27-
28- type NotFoundError struct {
29- Instance string
30- Input string
31- }
32-
33- func (e * NotFoundError ) Error () string {
34- return fmt .Sprintf ("%v %v not found" , e .Instance , e .Input )
35- }
36-
37- type NotFoundErrorInt struct {
38- Instance string
39- Input int32
40- }
41-
42- func (e * NotFoundErrorInt ) Error () string {
43- return fmt .Sprintf ("%v %v not found" , e .Instance , e .Input )
44- }
45-
46- type NotFoundErrorFieldHeader struct {
47- Instance string
48- Input FieldHeader
49- }
50-
51- func (e * NotFoundErrorFieldHeader ) Error () string {
52- return fmt .Sprintf ("%v %v not found" , e .Instance , e .Input )
53- }
54-
5517type Definitions struct {
5618 Types map [string ]int32
5719 LedgerEntryTypes map [string ]int32
@@ -60,6 +22,11 @@ type Definitions struct {
6022 TransactionTypes map [string ]int32
6123 FieldIDNameMap map [FieldHeader ]string
6224}
25+
26+ func Get () * Definitions {
27+ return definitions
28+ }
29+
6330type definitionsDoc struct {
6431 Types map [string ]int32 `json:"TYPES"`
6532 LedgerEntryTypes map [string ]int32 `json:"LEDGER_ENTRY_TYPES"`
0 commit comments