@@ -213,7 +213,7 @@ func getAttributeValueSql(id string, opts attributeValueSelectOptions) (string,
213213 "'value', vmv.value, " +
214214 "'active', vmv.active, " +
215215 "'members', vmv.members || ARRAY[]::UUID[], " +
216- "'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', vmv.metadata->'labels', 'created_at', vmv.created_at, 'updated_at', vmv.updated_at)), " +
216+ getMetadataField ( " vmv" , true ) +
217217 "'attribute', JSON_BUILD_OBJECT(" +
218218 "'id', vmv.attribute_definition_id )"
219219 if opts .withFqn {
@@ -225,7 +225,7 @@ func getAttributeValueSql(id string, opts attributeValueSelectOptions) (string,
225225 "av.value" ,
226226 "av.active" ,
227227 members ,
228- "JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', av.metadata->'labels', 'created_at', av.created_at, 'updated_at', av.updated_at)) as metadata" ,
228+ getMetadataField ( "av" , false ) ,
229229 "av.attribute_definition_id" ,
230230 }
231231 if opts .withFqn {
@@ -278,7 +278,7 @@ func listAttributeValuesSql(attribute_id string, opts attributeValueSelectOption
278278 "'value', vmv.value, " +
279279 "'active', vmv.active, " +
280280 "'members', vmv.members || ARRAY[]::UUID[], " +
281- "'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', vmv.metadata->'labels', 'created_at', vmv.created_at, 'updated_at', vmv.updated_at)), " +
281+ getMetadataField ( " vmv" , true ) +
282282 "'attribute', JSON_BUILD_OBJECT(" +
283283 "'id', vmv.attribute_definition_id )"
284284 if opts .withFqn {
@@ -290,7 +290,7 @@ func listAttributeValuesSql(attribute_id string, opts attributeValueSelectOption
290290 "av.value" ,
291291 "av.active" ,
292292 members ,
293- "JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', av.metadata->'labels', 'created_at', av.created_at, 'updated_at', av.updated_at)) as metadata" ,
293+ getMetadataField ( "av" , false ) ,
294294 "av.attribute_definition_id" ,
295295 }
296296 if opts .withFqn {
@@ -349,7 +349,7 @@ func listAllAttributeValuesSql(opts attributeValueSelectOptions) (string, []inte
349349 "'value', vmv.value, " +
350350 "'active', vmv.active, " +
351351 "'members', vmv.members || ARRAY[]::UUID[], " +
352- "'metadata', vmv.metadata, " +
352+ getMetadataField ( " vmv" , true ) +
353353 "'attribute', JSON_BUILD_OBJECT(" +
354354 "'id', vmv.attribute_definition_id )"
355355 if opts .withFqn {
@@ -361,7 +361,7 @@ func listAllAttributeValuesSql(opts attributeValueSelectOptions) (string, []inte
361361 "av.value" ,
362362 "av.active" ,
363363 members ,
364- "av.metadata" ,
364+ getMetadataField ( "av" , false ) ,
365365 "av.attribute_definition_id" ,
366366 }
367367 if opts .withFqn {
0 commit comments