From 32150d377bc822436db58b01e98eebb705fc68a9 Mon Sep 17 00:00:00 2001 From: Ashish Tiwari Date: Mon, 31 Oct 2022 13:58:49 +0530 Subject: [PATCH] lint checks Signed-off-by: Ashish Tiwari --- .../meshmodel/core/v1alpha1/component_capabilities_db.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/models/meshmodel/core/v1alpha1/component_capabilities_db.go b/models/meshmodel/core/v1alpha1/component_capabilities_db.go index b00f8683..fb407cd6 100644 --- a/models/meshmodel/core/v1alpha1/component_capabilities_db.go +++ b/models/meshmodel/core/v1alpha1/component_capabilities_db.go @@ -25,18 +25,23 @@ type ComponentCapabilityDB struct { Capability } +// ComponentCapabilityFromCCDB produces a client facing instance of ComponentCapability from a database representation of ComponentCapability. +// Use this function to interconvert any time the ComponentCapability is fetched from the database and is to be returned to client. func ComponentCapabilityFromCCDB(cdb ComponentCapabilityDB) (c ComponentCapability) { c.Capability = cdb.Capability c.TypeMeta = cdb.TypeMeta c.Spec = cdb.Spec m := make(map[string]interface{}) - json.Unmarshal(cdb.Metadata, &m) + _ = json.Unmarshal(cdb.Metadata, &m) c.Metadata = m schematic := make(map[string]interface{}) - json.Unmarshal(cdb.Schematic, &schematic) + _ = json.Unmarshal(cdb.Schematic, &schematic) c.Schematic = schematic return } + +// ComponentCapabilityDBFromCC produces a database compatible instance of ComponentCapability from a client representation of ComponentCapability. +// Use this function to interconvert any time the ComponentCapability is created by some client and is to be saved to the database. func ComponentCapabilityDBFromCC(c ComponentCapability) (cdb ComponentCapabilityDB) { cdb.Capability = c.Capability cdb.TypeMeta = c.TypeMeta