| 1 |
{{- define "putAttribute" -}} |
| 2 |
{{- if eq (attributeInfo .).Type.Primitive "[]byte" }} |
| 3 |
dp.Attributes().PutEmptyBytes("{{ (attributeInfo .).Name }}").FromRaw({{ .RenderUnexported }}AttributeValue) |
| 4 |
{{- else if eq (attributeInfo .).Type.Primitive "[]any" }} |
| 5 |
dp.Attributes().PutEmptySlice("{{ (attributeInfo .).Name }}").FromRaw({{ .RenderUnexported }}AttributeValue) |
| 6 |
{{- else if eq (attributeInfo .).Type.Primitive "map[string]any" }} |
| 7 |
dp.Attributes().PutEmptyMap("{{ (attributeInfo .).Name }}").FromRaw({{ .RenderUnexported }}AttributeValue) |
| 8 |
{{- else }} |
| 9 |
dp.Attributes().Put{{ (attributeInfo .).Type }}("{{ (attributeInfo .).Name }}", {{ .RenderUnexported }}AttributeValue) |
| 10 |
{{- end }} |
| 11 |
{{- end -}} |
| 12 |
|
| 13 |
{{- define "getAttributeValue" -}} |
| 14 |
{{ if (attributeInfo .).Enum }}Attribute{{ .Render }}{{ (index (attributeInfo .).Enum 0) | publicVar }}{{ else }}{{ (attributeInfo .).TestValue }}{{ end }} |
| 15 |
{{- end -}} |