MCPcopy
hub / github.com/pquerna/ffjson / generateCode

Method generateCode

inception/inception.go:100–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98func (p sortedStructs) Sort() { sort.Sort(p) }
99
100func (i *Inception) generateCode() error {
101 // We sort the structs by name, so output if predictable.
102 sorted := sortedStructs(i.objs)
103 sorted.Sort()
104
105 for _, si := range sorted {
106 if i.wantMarshal(si) {
107 err := CreateMarshalJSON(i, si)
108 if err != nil {
109 return err
110 }
111 }
112
113 if i.wantUnmarshal(si) {
114 err := CreateUnmarshalJSON(i, si)
115 if err != nil {
116 return err
117 }
118 }
119 }
120 return nil
121}
122
123func (i *Inception) handleError(err error) {
124 fmt.Fprintf(os.Stderr, "Error: %s:\n\n", err)

Callers 1

ExecuteMethod · 0.95

Calls 6

wantMarshalMethod · 0.95
wantUnmarshalMethod · 0.95
sortedStructsTypeAlias · 0.85
CreateMarshalJSONFunction · 0.85
CreateUnmarshalJSONFunction · 0.85
SortMethod · 0.80

Tested by

no test coverage detected