generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into MUzairS15/artifacthub-pkg
- Loading branch information
Showing
3 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package v1beta1 | ||
|
||
import ( | ||
"database/sql/driver" | ||
"encoding/json" | ||
|
||
"github.com/layer5io/meshkit/utils" | ||
) | ||
|
||
// CatalogData defines model for catalog_data. | ||
type CatalogData struct { | ||
//Tracks the specific content version that has been made available in the Catalog | ||
PublishedVersion string `json:"published_version"` | ||
|
||
// Compatibility A list of technologies included in or implicated by this design; a list of relevant technology tags. | ||
Compatibility []CatalogDataCompatibility `json:"compatibility"` | ||
|
||
// PatternCaveats Specific stipulations to consider and known behaviors to be aware of when using this design. | ||
PatternCaveats string `json:"pattern_caveats"` | ||
|
||
// PatternInfo Purpose of the design along with its intended and unintended uses. | ||
PatternInfo string `json:"pattern_info"` | ||
|
||
// Contains reference to the dark and light mode snapshots of the catalog. | ||
SnapshotURL []string `json:"imageURL,omitempty"` // this will require updating exisitng catalog data as well. updated the json tag to match previous key name, so changes will not be required in exisitng catgalogs | ||
|
||
// Type Categorization of the type of design or operational flow depicted in this design. | ||
Type CatalogDataType `json:"type"` | ||
} | ||
|
||
func (cd *CatalogData) Scan(value interface{}) error { | ||
if value == nil { | ||
cd = &CatalogData{} | ||
return nil | ||
} | ||
data, err := utils.Cast[[]byte](value) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
err = json.Unmarshal([]byte(data), cd) | ||
if err != nil { | ||
return utils.ErrUnmarshal(err) | ||
} | ||
return nil | ||
} | ||
|
||
func (cd CatalogData) Value() (driver.Value, error) { | ||
marshaledValue, err := json.Marshal(cd) | ||
if err != nil { | ||
return nil, utils.ErrMarshal(err) | ||
} | ||
return marshaledValue, nil | ||
} | ||
|
||
// CatalogDataCompatibility defines model for CatalogData.Compatibility. | ||
type CatalogDataCompatibility string | ||
|
||
// CatalogDataType Categorization of the type of design or operational flow depicted in this design. | ||
type CatalogDataType string | ||
|
||
func (cd *CatalogData) IsNil() bool { | ||
return cd == nil || (len(cd.Compatibility) == 0 && | ||
cd.PatternCaveats == "" && | ||
cd.PatternInfo == "" && | ||
cd.Type == "") | ||
} |