Skip to content

Commit

Permalink
change struct comment style
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoPedroAssis authored and bandreghetti committed Mar 26, 2021
1 parent 2547631 commit a77904d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
37 changes: 22 additions & 15 deletions assets/assetProp.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
package assets

//AssetProp describes properties of each asset attribute
// The tag is used to reference the prop
// The label is for frontend rendering
// The description is a simple explanation for the specific field
// IsKey defines if the prop is a Primary Key
// Readonly makes impossible to overwrite a property
// The DefaulValue is the assets default state
// DataType defines the asset's type. It can receive custom data types
// Writers is an array of orgs that specify who can write in the asset
// Validate receives a function to validate the asset input
type AssetProp struct {
Tag string `json:"tag"`
Label string `json:"label"`
// The tag is used to reference the prop
Tag string `json:"tag"`

// The label is for frontend rendering
Label string `json:"label"`

// The description is a simple explanation for the specific field
Description string `json:"description"`

IsKey bool `json:"isKey"`
// IsKey defines if the prop is a Primary Key
IsKey bool `json:"isKey"`

// Tells if the prop is required
Required bool `json:"required"`

// Readonly makes impossible to overwrite a property
ReadOnly bool `json:"readOnly"`

// The DefaulValue is the assets default state
DefaultValue interface{} `json:"defaultValue,omitempty"`

/* DataType can assume the following values:
Expand All @@ -29,9 +31,14 @@ type AssetProp struct {
*/
DataType string `json:"dataType"`

// Writers accepts either []string{'org1MSP', 'org2MSP'} and cc-tools will
// check for an exact match or []string{`$org\dMSP`} and cc-tools will
// Writers is an array of orgs that specify who can write in the asset
// and accepts either basic strings for exact matches
// eg. []string{'org1MSP', 'org2MSP'}
// or regular expressions
// eg. []string{`$org\dMSP`} and cc-tools will
// check for a match with regular expression `org\dMSP`
Writers []string `json:"writers"`
Writers []string `json:"writers"`

// Validate receives a function to validate the asset input
Validate func(interface{}) error `json:"-"`
}
23 changes: 14 additions & 9 deletions assets/assetType.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@ package assets
import "strings"

// AssetType is a list of all asset properties
// The label is for frontend rendering
// The description is a simple explanation for the specific field
// Props receives an array of assetProps, definig the assets properties
// Readers is an array that specifies which organizations can read the asset (used for private data)
// Validates is a function that performs the asset input validation
type AssetType struct {
Tag string `json:"tag"`
Label string `json:"label"`
// Tag is how the asset will be referenced
Tag string `json:"tag"`

// The label is for frontend rendering
Label string `json:"label"`

// The description is a simple explanation for the specific field
Description string `json:"description"`

Props []AssetProp `json:"props"`
Readers []string `json:"readers,omitempty"`
// Props receives an array of assetProps, definig the assets properties
Props []AssetProp `json:"props"`

// Readers is an array that specifies which organizations can read the asset (used for private data)
Readers []string `json:"readers,omitempty"`

// Validates is a function that performs the asset input validation
Validate func(Asset) error `json:"-"`
}

Expand Down

0 comments on commit a77904d

Please sign in to comment.