-
-
Notifications
You must be signed in to change notification settings - Fork 584
Expand file tree
/
Copy pathresult_encode_functions.go
More file actions
1075 lines (1012 loc) · 43.7 KB
/
Copy pathresult_encode_functions.go
File metadata and controls
1075 lines (1012 loc) · 43.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package testdata
var ResultHeaderBoolEncodeCode = `// EncodeMethodHeaderBoolResponse returns an encoder for responses returned by
// the ServiceHeaderBool MethodHeaderBool endpoint.
func EncodeMethodHeaderBoolResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderbool.MethodHeaderBoolResult)
if res.H != nil {
val := res.H
hs := strconv.FormatBool(*val)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderIntEncodeCode = `// EncodeMethodHeaderIntResponse returns an encoder for responses returned by
// the ServiceHeaderInt MethodHeaderInt endpoint.
func EncodeMethodHeaderIntResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderint.MethodHeaderIntResult)
if res.H != nil {
val := res.H
hs := strconv.Itoa(*val)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderInt32EncodeCode = `// EncodeMethodHeaderInt32Response returns an encoder for responses returned by
// the ServiceHeaderInt32 MethodHeaderInt32 endpoint.
func EncodeMethodHeaderInt32Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderint32.MethodHeaderInt32Result)
if res.H != nil {
val := res.H
hs := strconv.FormatInt(int64(*val), 10)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderInt64EncodeCode = `// EncodeMethodHeaderInt64Response returns an encoder for responses returned by
// the ServiceHeaderInt64 MethodHeaderInt64 endpoint.
func EncodeMethodHeaderInt64Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderint64.MethodHeaderInt64Result)
if res.H != nil {
val := res.H
hs := strconv.FormatInt(*val, 10)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderUIntEncodeCode = `// EncodeMethodHeaderUIntResponse returns an encoder for responses returned by
// the ServiceHeaderUInt MethodHeaderUInt endpoint.
func EncodeMethodHeaderUIntResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderuint.MethodHeaderUIntResult)
if res.H != nil {
val := res.H
hs := strconv.FormatUint(uint64(*val), 10)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderUInt32EncodeCode = `// EncodeMethodHeaderUInt32Response returns an encoder for responses returned
// by the ServiceHeaderUInt32 MethodHeaderUInt32 endpoint.
func EncodeMethodHeaderUInt32Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderuint32.MethodHeaderUInt32Result)
if res.H != nil {
val := res.H
hs := strconv.FormatUint(uint64(*val), 10)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderUInt64EncodeCode = `// EncodeMethodHeaderUInt64Response returns an encoder for responses returned
// by the ServiceHeaderUInt64 MethodHeaderUInt64 endpoint.
func EncodeMethodHeaderUInt64Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderuint64.MethodHeaderUInt64Result)
if res.H != nil {
val := res.H
hs := strconv.FormatUint(*val, 10)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderFloat32EncodeCode = `// EncodeMethodHeaderFloat32Response returns an encoder for responses returned
// by the ServiceHeaderFloat32 MethodHeaderFloat32 endpoint.
func EncodeMethodHeaderFloat32Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderfloat32.MethodHeaderFloat32Result)
if res.H != nil {
val := res.H
hs := strconv.FormatFloat(float64(*val), 'f', -1, 32)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderFloat64EncodeCode = `// EncodeMethodHeaderFloat64Response returns an encoder for responses returned
// by the ServiceHeaderFloat64 MethodHeaderFloat64 endpoint.
func EncodeMethodHeaderFloat64Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderfloat64.MethodHeaderFloat64Result)
if res.H != nil {
val := res.H
hs := strconv.FormatFloat(*val, 'f', -1, 64)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderStringEncodeCode = `// EncodeMethodHeaderStringResponse returns an encoder for responses returned
// by the ServiceHeaderString MethodHeaderString endpoint.
func EncodeMethodHeaderStringResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderstring.MethodHeaderStringResult)
if res.H != nil {
w.Header().Set("H", *res.H)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderBytesEncodeCode = `// EncodeMethodHeaderBytesResponse returns an encoder for responses returned by
// the ServiceHeaderBytes MethodHeaderBytes endpoint.
func EncodeMethodHeaderBytesResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderbytes.MethodHeaderBytesResult)
if res.H != nil {
val := res.H
hs := string(val)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderAnyEncodeCode = `// EncodeMethodHeaderAnyResponse returns an encoder for responses returned by
// the ServiceHeaderAny MethodHeaderAny endpoint.
func EncodeMethodHeaderAnyResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderany.MethodHeaderAnyResult)
if res.H != nil {
val := res.H
hs := fmt.Sprintf("%v", val)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayBoolEncodeCode = `// EncodeMethodHeaderArrayBoolResponse returns an encoder for responses
// returned by the ServiceHeaderArrayBool MethodHeaderArrayBool endpoint.
func EncodeMethodHeaderArrayBoolResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarraybool.MethodHeaderArrayBoolResult)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.FormatBool(e)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayIntEncodeCode = `// EncodeMethodHeaderArrayIntResponse returns an encoder for responses returned
// by the ServiceHeaderArrayInt MethodHeaderArrayInt endpoint.
func EncodeMethodHeaderArrayIntResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarrayint.MethodHeaderArrayIntResult)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.Itoa(e)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayInt32EncodeCode = `// EncodeMethodHeaderArrayInt32Response returns an encoder for responses
// returned by the ServiceHeaderArrayInt32 MethodHeaderArrayInt32 endpoint.
func EncodeMethodHeaderArrayInt32Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarrayint32.MethodHeaderArrayInt32Result)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.FormatInt(int64(e), 10)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayInt64EncodeCode = `// EncodeMethodHeaderArrayInt64Response returns an encoder for responses
// returned by the ServiceHeaderArrayInt64 MethodHeaderArrayInt64 endpoint.
func EncodeMethodHeaderArrayInt64Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarrayint64.MethodHeaderArrayInt64Result)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.FormatInt(e, 10)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayUIntEncodeCode = `// EncodeMethodHeaderArrayUIntResponse returns an encoder for responses
// returned by the ServiceHeaderArrayUInt MethodHeaderArrayUInt endpoint.
func EncodeMethodHeaderArrayUIntResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarrayuint.MethodHeaderArrayUIntResult)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.FormatUint(uint64(e), 10)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayUInt32EncodeCode = `// EncodeMethodHeaderArrayUInt32Response returns an encoder for responses
// returned by the ServiceHeaderArrayUInt32 MethodHeaderArrayUInt32 endpoint.
func EncodeMethodHeaderArrayUInt32Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarrayuint32.MethodHeaderArrayUInt32Result)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.FormatUint(uint64(e), 10)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayUInt64EncodeCode = `// EncodeMethodHeaderArrayUInt64Response returns an encoder for responses
// returned by the ServiceHeaderArrayUInt64 MethodHeaderArrayUInt64 endpoint.
func EncodeMethodHeaderArrayUInt64Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarrayuint64.MethodHeaderArrayUInt64Result)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.FormatUint(e, 10)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayFloat32EncodeCode = `// EncodeMethodHeaderArrayFloat32Response returns an encoder for responses
// returned by the ServiceHeaderArrayFloat32 MethodHeaderArrayFloat32 endpoint.
func EncodeMethodHeaderArrayFloat32Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarrayfloat32.MethodHeaderArrayFloat32Result)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.FormatFloat(float64(e), 'f', -1, 32)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayFloat64EncodeCode = `// EncodeMethodHeaderArrayFloat64Response returns an encoder for responses
// returned by the ServiceHeaderArrayFloat64 MethodHeaderArrayFloat64 endpoint.
func EncodeMethodHeaderArrayFloat64Response(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarrayfloat64.MethodHeaderArrayFloat64Result)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.FormatFloat(e, 'f', -1, 64)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayStringEncodeCode = `// EncodeMethodHeaderArrayStringResponse returns an encoder for responses
// returned by the ServiceHeaderArrayString MethodHeaderArrayString endpoint.
func EncodeMethodHeaderArrayStringResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarraystring.MethodHeaderArrayStringResult)
if res.H != nil {
val := res.H
hs := strings.Join(val, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayBytesEncodeCode = `// EncodeMethodHeaderArrayBytesResponse returns an encoder for responses
// returned by the ServiceHeaderArrayBytes MethodHeaderArrayBytes endpoint.
func EncodeMethodHeaderArrayBytesResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarraybytes.MethodHeaderArrayBytesResult)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := string(e)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayAnyEncodeCode = `// EncodeMethodHeaderArrayAnyResponse returns an encoder for responses returned
// by the ServiceHeaderArrayAny MethodHeaderArrayAny endpoint.
func EncodeMethodHeaderArrayAnyResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarrayany.MethodHeaderArrayAnyResult)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := fmt.Sprintf("%v", e)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderBoolDefaultEncodeCode = `// EncodeMethodHeaderBoolDefaultResponse returns an encoder for responses
// returned by the ServiceHeaderBoolDefault MethodHeaderBoolDefault endpoint.
func EncodeMethodHeaderBoolDefaultResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderbooldefault.MethodHeaderBoolDefaultResult)
{
val := res.H
hs := strconv.FormatBool(val)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderBoolRequiredDefaultEncodeCode = `// EncodeMethodHeaderBoolRequiredDefaultResponse returns an encoder for
// responses returned by the ServiceHeaderBoolRequiredDefault
// MethodHeaderBoolRequiredDefault endpoint.
func EncodeMethodHeaderBoolRequiredDefaultResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderboolrequireddefault.MethodHeaderBoolRequiredDefaultResult)
{
val := res.H
hs := strconv.FormatBool(val)
w.Header().Set("H", hs)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderStringDefaultEncodeCode = `// EncodeMethodHeaderStringDefaultResponse returns an encoder for responses
// returned by the ServiceHeaderStringDefault MethodHeaderStringDefault
// endpoint.
func EncodeMethodHeaderStringDefaultResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderstringdefault.MethodHeaderStringDefaultResult)
w.Header().Set("H", res.H)
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderStringRequiredDefaultEncodeCode = `// EncodeMethodHeaderStringRequiredDefaultResponse returns an encoder for
// responses returned by the ServiceHeaderStringRequiredDefault
// MethodHeaderStringRequiredDefault endpoint.
func EncodeMethodHeaderStringRequiredDefaultResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderstringrequireddefault.MethodHeaderStringRequiredDefaultResult)
w.Header().Set("H", res.H)
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayBoolDefaultEncodeCode = `// EncodeMethodHeaderArrayBoolDefaultResponse returns an encoder for responses
// returned by the ServiceHeaderArrayBoolDefault MethodHeaderArrayBoolDefault
// endpoint.
func EncodeMethodHeaderArrayBoolDefaultResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarraybooldefault.MethodHeaderArrayBoolDefaultResult)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.FormatBool(e)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
} else {
w.Header().Set("H", "true, false")
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayBoolRequiredDefaultEncodeCode = `// EncodeMethodHeaderArrayBoolRequiredDefaultResponse returns an encoder for
// responses returned by the ServiceHeaderArrayBoolRequiredDefault
// MethodHeaderArrayBoolRequiredDefault endpoint.
func EncodeMethodHeaderArrayBoolRequiredDefaultResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarrayboolrequireddefault.MethodHeaderArrayBoolRequiredDefaultResult)
if res.H != nil {
val := res.H
hsSlice := make([]string, len(val))
for i, e := range val {
es := strconv.FormatBool(e)
hsSlice[i] = es
}
hs := strings.Join(hsSlice, ", ")
w.Header().Set("H", hs)
} else {
w.Header().Set("H", "true, false")
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayStringDefaultEncodeCode = `// EncodeMethodHeaderArrayStringDefaultResponse returns an encoder for
// responses returned by the ServiceHeaderArrayStringDefault
// MethodHeaderArrayStringDefault endpoint.
func EncodeMethodHeaderArrayStringDefaultResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarraystringdefault.MethodHeaderArrayStringDefaultResult)
if res.H != nil {
val := res.H
hs := strings.Join(val, ", ")
w.Header().Set("H", hs)
} else {
w.Header().Set("H", "foo, bar")
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultHeaderArrayStringRequiredDefaultEncodeCode = `// EncodeMethodHeaderArrayStringRequiredDefaultResponse returns an encoder for
// responses returned by the ServiceHeaderArrayStringRequiredDefault
// MethodHeaderArrayStringRequiredDefault endpoint.
func EncodeMethodHeaderArrayStringRequiredDefaultResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceheaderarraystringrequireddefault.MethodHeaderArrayStringRequiredDefaultResult)
if res.H != nil {
val := res.H
hs := strings.Join(val, ", ")
w.Header().Set("H", hs)
} else {
w.Header().Set("H", "foo, bar")
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultBodyStringEncodeCode = `// EncodeMethodBodyStringResponse returns an encoder for responses returned by
// the ServiceBodyString MethodBodyString endpoint.
func EncodeMethodBodyStringResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicebodystring.MethodBodyStringResult)
enc := encoder(ctx, w)
body := NewMethodBodyStringResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyObjectEncodeCode = `// EncodeMethodBodyObjectResponse returns an encoder for responses returned by
// the ServiceBodyObject MethodBodyObject endpoint.
func EncodeMethodBodyObjectResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicebodyobject.MethodBodyObjectResult)
enc := encoder(ctx, w)
body := NewMethodBodyObjectResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyUserEncodeCode = `// EncodeMethodBodyUserResponse returns an encoder for responses returned by
// the ServiceBodyUser MethodBodyUser endpoint.
func EncodeMethodBodyUserResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicebodyuser.ResultType)
enc := encoder(ctx, w)
body := NewMethodBodyUserResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyUnionEncodeCode = `// EncodeMethodBodyUnionResponse returns an encoder for responses returned by
// the ServiceBodyUnion MethodBodyUnion endpoint.
func EncodeMethodBodyUnionResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicebodyunion.Union)
enc := encoder(ctx, w)
body := NewMethodBodyUnionResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyMultipleViewsEncodeCode = `// EncodeMethodBodyMultipleViewResponse returns an encoder for responses
// returned by the ServiceBodyMultipleView MethodBodyMultipleView endpoint.
func EncodeMethodBodyMultipleViewResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res := v.(*servicebodymultipleviewviews.Resulttypemultipleviews)
w.Header().Set("goa-view", res.View)
enc := encoder(ctx, w)
var body any
switch res.View {
case "default", "":
body = NewMethodBodyMultipleViewResponseBody(res.Projected)
case "tiny":
body = NewMethodBodyMultipleViewResponseBodyTiny(res.Projected)
}
if res.Projected.C != nil {
w.Header().Set("Location", *res.Projected.C)
}
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyCollectionMultipleViewsEncodeCode = `// EncodeMethodBodyCollectionResponse returns an encoder for responses returned
// by the ServiceBodyCollection MethodBodyCollection endpoint.
func EncodeMethodBodyCollectionResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res := v.(servicebodycollectionviews.ResulttypecollectionCollection)
w.Header().Set("goa-view", res.View)
enc := encoder(ctx, w)
var body any
switch res.View {
case "default", "":
body = NewResulttypecollectionResponseCollection(res.Projected)
case "tiny":
body = NewResulttypecollectionResponseTinyCollection(res.Projected)
}
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyCollectionExplicitViewEncodeCode = `// EncodeMethodBodyCollectionExplicitViewResponse returns an encoder for
// responses returned by the ServiceBodyCollectionExplicitView
// MethodBodyCollectionExplicitView endpoint.
func EncodeMethodBodyCollectionExplicitViewResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res := v.(servicebodycollectionexplicitviewviews.ResulttypecollectionCollection)
enc := encoder(ctx, w)
body := NewResulttypecollectionResponseTinyCollection(res.Projected)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var EmptyBodyResultMultipleViewsEncodeCode = `// EncodeMethodEmptyBodyResultMultipleViewResponse returns an encoder for
// responses returned by the ServiceEmptyBodyResultMultipleView
// MethodEmptyBodyResultMultipleView endpoint.
func EncodeMethodEmptyBodyResultMultipleViewResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res := v.(*serviceemptybodyresultmultipleviewviews.Resulttypemultipleviews)
w.Header().Set("goa-view", res.View)
if res.Projected.C != nil {
w.Header().Set("Location", *res.Projected.C)
}
w.WriteHeader(http.StatusOK)
return nil
}
}
`
var ResultBodyArrayStringEncodeCode = `// EncodeMethodBodyArrayStringResponse returns an encoder for responses
// returned by the ServiceBodyArrayString MethodBodyArrayString endpoint.
func EncodeMethodBodyArrayStringResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicebodyarraystring.MethodBodyArrayStringResult)
enc := encoder(ctx, w)
body := NewMethodBodyArrayStringResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyArrayUserEncodeCode = `// EncodeMethodBodyArrayUserResponse returns an encoder for responses returned
// by the ServiceBodyArrayUser MethodBodyArrayUser endpoint.
func EncodeMethodBodyArrayUserResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicebodyarrayuser.MethodBodyArrayUserResult)
enc := encoder(ctx, w)
body := NewMethodBodyArrayUserResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ExplicitBodyPrimitiveResultMultipleViewsEncodeCode = `// EncodeMethodExplicitBodyPrimitiveResultMultipleViewResponse returns an
// encoder for responses returned by the
// ServiceExplicitBodyPrimitiveResultMultipleView
// MethodExplicitBodyPrimitiveResultMultipleView endpoint.
func EncodeMethodExplicitBodyPrimitiveResultMultipleViewResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res := v.(*serviceexplicitbodyprimitiveresultmultipleviewviews.Resulttypemultipleviews)
w.Header().Set("goa-view", res.View)
enc := encoder(ctx, w)
body := res.Projected.A
if res.Projected.C != nil {
w.Header().Set("Location", *res.Projected.C)
}
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ExplicitBodyUserResultMultipleViewsEncodeCode = `// EncodeMethodExplicitBodyUserResultMultipleViewResponse returns an encoder
// for responses returned by the ServiceExplicitBodyUserResultMultipleView
// MethodExplicitBodyUserResultMultipleView endpoint.
func EncodeMethodExplicitBodyUserResultMultipleViewResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res := v.(*serviceexplicitbodyuserresultmultipleviewviews.Resulttypemultipleviews)
w.Header().Set("goa-view", res.View)
enc := encoder(ctx, w)
body := NewMethodExplicitBodyUserResultMultipleViewResponseBody(res.Projected)
if res.Projected.C != nil {
w.Header().Set("Location", *res.Projected.C)
}
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ExplicitBodyResultCollectionEncodeCode = `// EncodeMethodExplicitBodyResultCollectionResponse returns an encoder for
// responses returned by the ServiceExplicitBodyResultCollection
// MethodExplicitBodyResultCollection endpoint.
func EncodeMethodExplicitBodyResultCollectionResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*serviceexplicitbodyresultcollection.MethodExplicitBodyResultCollectionResult)
enc := encoder(ctx, w)
body := NewResulttypeCollection(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ExplicitContentTypeResultEncodeCode = `// EncodeMethodExplicitContentTypeResultResponse returns an encoder for
// responses returned by the ServiceExplicitContentTypeResult
// MethodExplicitContentTypeResult endpoint.
func EncodeMethodExplicitContentTypeResultResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res := v.(*serviceexplicitcontenttyperesultviews.Resulttype)
ctx = context.WithValue(ctx, goahttp.ContentTypeKey, "application/custom+json")
enc := encoder(ctx, w)
body := NewMethodExplicitContentTypeResultResponseBody(res.Projected)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ExplicitContentTypeResponseEncodeCode = `// EncodeMethodExplicitContentTypeResponseResponse returns an encoder for
// responses returned by the ServiceExplicitContentTypeResponse
// MethodExplicitContentTypeResponse endpoint.
func EncodeMethodExplicitContentTypeResponseResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res := v.(*serviceexplicitcontenttyperesponseviews.Resulttype)
ctx = context.WithValue(ctx, goahttp.ContentTypeKey, "application/custom+json")
enc := encoder(ctx, w)
body := NewMethodExplicitContentTypeResponseResponseBody(res.Projected)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyPrimitiveStringEncodeCode = `// EncodeMethodBodyPrimitiveStringResponse returns an encoder for responses
// returned by the ServiceBodyPrimitiveString MethodBodyPrimitiveString
// endpoint.
func EncodeMethodBodyPrimitiveStringResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(string)
enc := encoder(ctx, w)
body := res
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyPrimitiveBoolEncodeCode = `// EncodeMethodBodyPrimitiveBoolResponse returns an encoder for responses
// returned by the ServiceBodyPrimitiveBool MethodBodyPrimitiveBool endpoint.
func EncodeMethodBodyPrimitiveBoolResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(bool)
enc := encoder(ctx, w)
body := res
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyPrimitiveAnyEncodeCode = `// EncodeMethodBodyPrimitiveAnyResponse returns an encoder for responses
// returned by the ServiceBodyPrimitiveAny MethodBodyPrimitiveAny endpoint.
func EncodeMethodBodyPrimitiveAnyResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(any)
enc := encoder(ctx, w)
body := res
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyPrimitiveArrayStringEncodeCode = `// EncodeMethodBodyPrimitiveArrayStringResponse returns an encoder for
// responses returned by the ServiceBodyPrimitiveArrayString
// MethodBodyPrimitiveArrayString endpoint.
func EncodeMethodBodyPrimitiveArrayStringResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.([]string)
enc := encoder(ctx, w)
body := res
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyPrimitiveArrayBoolEncodeCode = `// EncodeMethodBodyPrimitiveArrayBoolResponse returns an encoder for responses
// returned by the ServiceBodyPrimitiveArrayBool MethodBodyPrimitiveArrayBool
// endpoint.
func EncodeMethodBodyPrimitiveArrayBoolResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.([]bool)
enc := encoder(ctx, w)
body := res
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyPrimitiveArrayUserEncodeCode = `// EncodeMethodBodyPrimitiveArrayUserResponse returns an encoder for responses
// returned by the ServiceBodyPrimitiveArrayUser MethodBodyPrimitiveArrayUser
// endpoint.
func EncodeMethodBodyPrimitiveArrayUserResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.([]*servicebodyprimitivearrayuser.ResultType)
enc := encoder(ctx, w)
body := NewMethodBodyPrimitiveArrayUserResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyInlineObjectEncodeCode = `// EncodeMethodBodyInlineObjectResponse returns an encoder for responses
// returned by the ServiceBodyInlineObject MethodBodyInlineObject endpoint.
func EncodeMethodBodyInlineObjectResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicebodyinlineobject.ResultType)
enc := encoder(ctx, w)
body := NewMethodBodyInlineObjectResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyHeaderObjectEncodeCode = `// EncodeMethodBodyHeaderObjectResponse returns an encoder for responses
// returned by the ServiceBodyHeaderObject MethodBodyHeaderObject endpoint.
func EncodeMethodBodyHeaderObjectResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicebodyheaderobject.MethodBodyHeaderObjectResult)
enc := encoder(ctx, w)
body := NewMethodBodyHeaderObjectResponseBody(res)
if res.B != nil {
w.Header().Set("B", *res.B)
}
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultBodyHeaderUserEncodeCode = `// EncodeMethodBodyHeaderUserResponse returns an encoder for responses returned
// by the ServiceBodyHeaderUser MethodBodyHeaderUser endpoint.
func EncodeMethodBodyHeaderUserResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicebodyheaderuser.ResultType)
enc := encoder(ctx, w)
body := NewMethodBodyHeaderUserResponseBody(res)
if res.B != nil {
w.Header().Set("B", *res.B)
}
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultTagStringEncodeCode = `// EncodeMethodTagStringResponse returns an encoder for responses returned by
// the ServiceTagString MethodTagString endpoint.
func EncodeMethodTagStringResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicetagstring.MethodTagStringResult)
if res.H != nil && *res.H == "value" {
w.Header().Set("H", *res.H)
w.WriteHeader(http.StatusAccepted)
return nil
}
enc := encoder(ctx, w)
body := NewMethodTagStringOKResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultTagStringRequiredEncodeCode = `// EncodeMethodTagStringRequiredResponse returns an encoder for responses
// returned by the ServiceTagStringRequired MethodTagStringRequired endpoint.
func EncodeMethodTagStringRequiredResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*servicetagstringrequired.MethodTagStringRequiredResult)
if res.H == "value" {
w.Header().Set("H", res.H)
w.WriteHeader(http.StatusAccepted)
return nil
}
enc := encoder(ctx, w)
body := NewMethodTagStringRequiredOKResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
`
var ResultMultipleViewsTagEncodeCode = `// EncodeMethodTagMultipleViewsResponse returns an encoder for responses
// returned by the ServiceTagMultipleViews MethodTagMultipleViews endpoint.
func EncodeMethodTagMultipleViewsResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res := v.(*servicetagmultipleviewsviews.Resulttypemultipleviews)
w.Header().Set("goa-view", res.View)
if res.Projected.B != nil && *res.Projected.B == "value" {
enc := encoder(ctx, w)
var body any
switch res.View {
case "default", "":
body = NewMethodTagMultipleViewsAcceptedResponseBody(res.Projected)
case "tiny":
body = NewMethodTagMultipleViewsAcceptedResponseBodyTiny(res.Projected)
}
w.Header().Set("C", *res.Projected.C)
w.WriteHeader(http.StatusAccepted)
return enc.Encode(body)
}
enc := encoder(ctx, w)
var body any
switch res.View {