Skip to content

Commit 2172502

Browse files
author
Chris Busbey
committed
new for repeating groups
1 parent b446540 commit 2172502

File tree

659 files changed

+5460
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

659 files changed

+5460
-9
lines changed

_gen/helpers.go

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,35 @@ import ({{ range .}}
3333
)
3434
{{ end}}
3535
36-
{{/* template writes out a constructor for message/component/group */}}
37-
{{define "new"}}
38-
func New(
39-
{{- range $index, $field := .RequiredParts -}}
40-
{{if $index}},{{end}}{{toLower $field.Name}} {{partAsGoType $field}}
41-
{{- end }}) *{{.Name}} {
36+
37+
{{/* template writes out a constructor for message and component type */}}
38+
{{define "new"}}
39+
//New returns an initialized {{.Name}} instance
40+
func New({{ template "parts_args" .RequiredParts}}) *{{.Name}} {
4241
var m {{.Name}}
43-
{{- range .RequiredFields}}
42+
{{- range .RequiredParts}}
4443
m.Set{{.Name}}({{toLower .Name}})
4544
{{- end}}
4645
return &m
4746
}
48-
{{end}}
47+
{{end}}
48+
49+
{{/* template writes out a constructor for group */}}
50+
{{define "newgroup"}}
51+
//New{{.Name}} returns an initialized {{.Name}} instance
52+
func New{{.Name}}({{ template "parts_args" .RequiredParts}}) *{{.Name}} {
53+
var m {{.Name}}
54+
{{- range .RequiredParts}}
55+
m.Set{{.Name}}({{toLower .Name}})
56+
{{- end}}
57+
return &m
58+
}
59+
{{end}}
60+
61+
{{/* template writes out a comma delimited list of parts to be used as an argument list*/}}
62+
{{define "parts_args"}}
63+
{{- range $index, $field := . }}{{if $index}},{{end}}{{toLower $field.Name}} {{partAsGoType $field}}{{ end }}
64+
{{- end }}
4965
5066
{{define "fieldSetter"}}
5167
func (m *{{.Receiver}}) Set{{.Name}}(v {{ if .IsGroup}}[]{{.Name}}{{else}}{{fixFieldTypeToGoType .Type}}{{end}}) {
@@ -168,10 +184,13 @@ func WriteGroupDeclaration(fixSpecMajor, fixSpecMinor int, field *datadictionary
168184
fileOut += fmt.Sprintf("//%v is a repeating group in %v\n", field.Name(), parent)
169185
fileOut += fmt.Sprintf("type %v struct {\n", field.Name())
170186
fileOut += WriteFieldDeclarations(fixSpecMajor, fixSpecMinor, field.Parts, field.Name())
171-
172187
fileOut += "}\n"
173188

174189
writer := new(bytes.Buffer)
190+
if err := genTemplate.ExecuteTemplate(writer, "newgroup", *field); err != nil {
191+
panic(err)
192+
}
193+
175194
if err := WriteFieldSetters(writer, field.Name(), field.Parts); err != nil {
176195
panic(err)
177196
}

fix40/allocation/Allocation.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ type NoOrders struct {
2020
WaveNo *string `fix:"105"`
2121
}
2222

23+
//NewNoOrders returns an initialized NoOrders instance
24+
func NewNoOrders(clordid string) *NoOrders {
25+
var m NoOrders
26+
m.SetClOrdID(clordid)
27+
return &m
28+
}
29+
2330
func (m *NoOrders) SetClOrdID(v string) { m.ClOrdID = v }
2431
func (m *NoOrders) SetOrderID(v string) { m.OrderID = &v }
2532
func (m *NoOrders) SetListID(v string) { m.ListID = &v }
@@ -37,6 +44,12 @@ type NoExecs struct {
3744
LastMkt *string `fix:"30"`
3845
}
3946

47+
//NewNoExecs returns an initialized NoExecs instance
48+
func NewNoExecs() *NoExecs {
49+
var m NoExecs
50+
return &m
51+
}
52+
4053
func (m *NoExecs) SetExecID(v int) { m.ExecID = &v }
4154
func (m *NoExecs) SetLastShares(v int) { m.LastShares = &v }
4255
func (m *NoExecs) SetLastPx(v float64) { m.LastPx = &v }
@@ -52,6 +65,12 @@ type NoMiscFees struct {
5265
MiscFeeType *string `fix:"139"`
5366
}
5467

68+
//NewNoMiscFees returns an initialized NoMiscFees instance
69+
func NewNoMiscFees() *NoMiscFees {
70+
var m NoMiscFees
71+
return &m
72+
}
73+
5574
func (m *NoMiscFees) SetMiscFeeAmt(v float64) { m.MiscFeeAmt = &v }
5675
func (m *NoMiscFees) SetMiscFeeCurr(v string) { m.MiscFeeCurr = &v }
5776
func (m *NoMiscFees) SetMiscFeeType(v string) { m.MiscFeeType = &v }
@@ -80,6 +99,14 @@ type NoAllocs struct {
8099
DlvyInst *string `fix:"86"`
81100
}
82101

102+
//NewNoAllocs returns an initialized NoAllocs instance
103+
func NewNoAllocs(allocaccount string, allocshares int) *NoAllocs {
104+
var m NoAllocs
105+
m.SetAllocAccount(allocaccount)
106+
m.SetAllocShares(allocshares)
107+
return &m
108+
}
109+
83110
func (m *NoAllocs) SetAllocAccount(v string) { m.AllocAccount = v }
84111
func (m *NoAllocs) SetAllocShares(v int) { m.AllocShares = v }
85112
func (m *NoAllocs) SetProcessCode(v string) { m.ProcessCode = &v }

fix40/executionreport/ExecutionReport.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ type NoMiscFees struct {
1818
MiscFeeType *string `fix:"139"`
1919
}
2020

21+
//NewNoMiscFees returns an initialized NoMiscFees instance
22+
func NewNoMiscFees() *NoMiscFees {
23+
var m NoMiscFees
24+
return &m
25+
}
26+
2127
func (m *NoMiscFees) SetMiscFeeAmt(v float64) { m.MiscFeeAmt = &v }
2228
func (m *NoMiscFees) SetMiscFeeCurr(v string) { m.MiscFeeCurr = &v }
2329
func (m *NoMiscFees) SetMiscFeeType(v string) { m.MiscFeeType = &v }

fix40/liststatus/ListStatus.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ type NoOrders struct {
1919
AvgPx float64 `fix:"6"`
2020
}
2121

22+
//NewNoOrders returns an initialized NoOrders instance
23+
func NewNoOrders(clordid string, cumqty int, cxlqty int, avgpx float64) *NoOrders {
24+
var m NoOrders
25+
m.SetClOrdID(clordid)
26+
m.SetCumQty(cumqty)
27+
m.SetCxlQty(cxlqty)
28+
m.SetAvgPx(avgpx)
29+
return &m
30+
}
31+
2232
func (m *NoOrders) SetClOrdID(v string) { m.ClOrdID = v }
2333
func (m *NoOrders) SetCumQty(v int) { m.CumQty = v }
2434
func (m *NoOrders) SetCxlQty(v int) { m.CxlQty = v }

fix41/allocation/Allocation.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ type NoOrders struct {
2222
WaveNo *string `fix:"105"`
2323
}
2424

25+
//NewNoOrders returns an initialized NoOrders instance
26+
func NewNoOrders() *NoOrders {
27+
var m NoOrders
28+
return &m
29+
}
30+
2531
func (m *NoOrders) SetClOrdID(v string) { m.ClOrdID = &v }
2632
func (m *NoOrders) SetOrderID(v string) { m.OrderID = &v }
2733
func (m *NoOrders) SetSecondaryOrderID(v string) { m.SecondaryOrderID = &v }
@@ -40,6 +46,12 @@ type NoExecs struct {
4046
LastCapacity *string `fix:"29"`
4147
}
4248

49+
//NewNoExecs returns an initialized NoExecs instance
50+
func NewNoExecs() *NoExecs {
51+
var m NoExecs
52+
return &m
53+
}
54+
4355
func (m *NoExecs) SetLastShares(v int) { m.LastShares = &v }
4456
func (m *NoExecs) SetExecID(v string) { m.ExecID = &v }
4557
func (m *NoExecs) SetLastPx(v float64) { m.LastPx = &v }
@@ -89,6 +101,13 @@ type NoAllocs struct {
89101
NoMiscFees []NoMiscFees `fix:"136,omitempty"`
90102
}
91103

104+
//NewNoAllocs returns an initialized NoAllocs instance
105+
func NewNoAllocs(allocshares int) *NoAllocs {
106+
var m NoAllocs
107+
m.SetAllocShares(allocshares)
108+
return &m
109+
}
110+
92111
func (m *NoAllocs) SetAllocAccount(v string) { m.AllocAccount = &v }
93112
func (m *NoAllocs) SetAllocShares(v int) { m.AllocShares = v }
94113
func (m *NoAllocs) SetProcessCode(v string) { m.ProcessCode = &v }
@@ -120,6 +139,12 @@ type NoMiscFees struct {
120139
MiscFeeType *string `fix:"139"`
121140
}
122141

142+
//NewNoMiscFees returns an initialized NoMiscFees instance
143+
func NewNoMiscFees() *NoMiscFees {
144+
var m NoMiscFees
145+
return &m
146+
}
147+
123148
func (m *NoMiscFees) SetMiscFeeAmt(v float64) { m.MiscFeeAmt = &v }
124149
func (m *NoMiscFees) SetMiscFeeCurr(v string) { m.MiscFeeCurr = &v }
125150
func (m *NoMiscFees) SetMiscFeeType(v string) { m.MiscFeeType = &v }

fix41/email/Email.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ type NoRelatedSym struct {
3838
SecurityDesc *string `fix:"107"`
3939
}
4040

41+
//NewNoRelatedSym returns an initialized NoRelatedSym instance
42+
func NewNoRelatedSym() *NoRelatedSym {
43+
var m NoRelatedSym
44+
return &m
45+
}
46+
4147
func (m *NoRelatedSym) SetRelatdSym(v string) { m.RelatdSym = &v }
4248
func (m *NoRelatedSym) SetSymbolSfx(v string) { m.SymbolSfx = &v }
4349
func (m *NoRelatedSym) SetSecurityID(v string) { m.SecurityID = &v }
@@ -58,6 +64,13 @@ type LinesOfText struct {
5864
Text string `fix:"58"`
5965
}
6066

67+
//NewLinesOfText returns an initialized LinesOfText instance
68+
func NewLinesOfText(text string) *LinesOfText {
69+
var m LinesOfText
70+
m.SetText(text)
71+
return &m
72+
}
73+
6174
func (m *LinesOfText) SetText(v string) { m.Text = v }
6275

6376
//Message is a Email FIX Message

fix41/indicationofinterest/IndicationofInterest.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ type NoIOIQualifiers struct {
1414
IOIQualifier *string `fix:"104"`
1515
}
1616

17+
//NewNoIOIQualifiers returns an initialized NoIOIQualifiers instance
18+
func NewNoIOIQualifiers() *NoIOIQualifiers {
19+
var m NoIOIQualifiers
20+
return &m
21+
}
22+
1723
func (m *NoIOIQualifiers) SetIOIQualifier(v string) { m.IOIQualifier = &v }
1824

1925
//Message is a IndicationofInterest FIX Message

fix41/liststatus/ListStatus.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ type NoOrders struct {
2121
AvgPx float64 `fix:"6"`
2222
}
2323

24+
//NewNoOrders returns an initialized NoOrders instance
25+
func NewNoOrders(clordid string, cumqty int, leavesqty int, cxlqty int, avgpx float64) *NoOrders {
26+
var m NoOrders
27+
m.SetClOrdID(clordid)
28+
m.SetCumQty(cumqty)
29+
m.SetLeavesQty(leavesqty)
30+
m.SetCxlQty(cxlqty)
31+
m.SetAvgPx(avgpx)
32+
return &m
33+
}
34+
2435
func (m *NoOrders) SetClOrdID(v string) { m.ClOrdID = v }
2536
func (m *NoOrders) SetCumQty(v int) { m.CumQty = v }
2637
func (m *NoOrders) SetLeavesQty(v int) { m.LeavesQty = v }

fix41/news/News.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ type NoRelatedSym struct {
3838
SecurityDesc *string `fix:"107"`
3939
}
4040

41+
//NewNoRelatedSym returns an initialized NoRelatedSym instance
42+
func NewNoRelatedSym() *NoRelatedSym {
43+
var m NoRelatedSym
44+
return &m
45+
}
46+
4147
func (m *NoRelatedSym) SetRelatdSym(v string) { m.RelatdSym = &v }
4248
func (m *NoRelatedSym) SetSymbolSfx(v string) { m.SymbolSfx = &v }
4349
func (m *NoRelatedSym) SetSecurityID(v string) { m.SecurityID = &v }
@@ -58,6 +64,13 @@ type LinesOfText struct {
5864
Text string `fix:"58"`
5965
}
6066

67+
//NewLinesOfText returns an initialized LinesOfText instance
68+
func NewLinesOfText(text string) *LinesOfText {
69+
var m LinesOfText
70+
m.SetText(text)
71+
return &m
72+
}
73+
6174
func (m *LinesOfText) SetText(v string) { m.Text = v }
6275

6376
//Message is a News FIX Message

fix42/allocation/Allocation.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ type NoOrders struct {
2222
WaveNo *string `fix:"105"`
2323
}
2424

25+
//NewNoOrders returns an initialized NoOrders instance
26+
func NewNoOrders() *NoOrders {
27+
var m NoOrders
28+
return &m
29+
}
30+
2531
func (m *NoOrders) SetClOrdID(v string) { m.ClOrdID = &v }
2632
func (m *NoOrders) SetOrderID(v string) { m.OrderID = &v }
2733
func (m *NoOrders) SetSecondaryOrderID(v string) { m.SecondaryOrderID = &v }
@@ -40,6 +46,12 @@ type NoExecs struct {
4046
LastCapacity *string `fix:"29"`
4147
}
4248

49+
//NewNoExecs returns an initialized NoExecs instance
50+
func NewNoExecs() *NoExecs {
51+
var m NoExecs
52+
return &m
53+
}
54+
4355
func (m *NoExecs) SetLastShares(v float64) { m.LastShares = &v }
4456
func (m *NoExecs) SetExecID(v string) { m.ExecID = &v }
4557
func (m *NoExecs) SetLastPx(v float64) { m.LastPx = &v }
@@ -95,6 +107,13 @@ type NoAllocs struct {
95107
NoMiscFees []NoMiscFees `fix:"136,omitempty"`
96108
}
97109

110+
//NewNoAllocs returns an initialized NoAllocs instance
111+
func NewNoAllocs(allocshares float64) *NoAllocs {
112+
var m NoAllocs
113+
m.SetAllocShares(allocshares)
114+
return &m
115+
}
116+
98117
func (m *NoAllocs) SetAllocAccount(v string) { m.AllocAccount = &v }
99118
func (m *NoAllocs) SetAllocPrice(v float64) { m.AllocPrice = &v }
100119
func (m *NoAllocs) SetAllocShares(v float64) { m.AllocShares = v }
@@ -129,6 +148,12 @@ type NoMiscFees struct {
129148
MiscFeeType *string `fix:"139"`
130149
}
131150

151+
//NewNoMiscFees returns an initialized NoMiscFees instance
152+
func NewNoMiscFees() *NoMiscFees {
153+
var m NoMiscFees
154+
return &m
155+
}
156+
132157
func (m *NoMiscFees) SetMiscFeeAmt(v float64) { m.MiscFeeAmt = &v }
133158
func (m *NoMiscFees) SetMiscFeeCurr(v string) { m.MiscFeeCurr = &v }
134159
func (m *NoMiscFees) SetMiscFeeType(v string) { m.MiscFeeType = &v }

0 commit comments

Comments
 (0)