Skip to content

Commit

Permalink
lint checks
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Tiwari <ashishjaitiwari15112000@gmail.com>
  • Loading branch information
Revolyssup committed Oct 31, 2022
1 parent d2cba67 commit 32150d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions models/meshmodel/core/v1alpha1/component_capabilities_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 32150d3

Please sign in to comment.