Added pm.Meta

This commit is contained in:
sm
2018-03-02 23:22:57 -08:00
parent 4b79c0c765
commit 63c38d5e92
2 changed files with 119 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
package pm
import "errors"
type Meta struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Namespace string `json:"namespace"`
}
func (m *Meta) Valid() (bool, error) {
if m.Name == "" {
return false, errors.New("name cannot be empty")
}
if m.Version == "" {
return false, errors.New("version cannot be empty")
}
if m.Description == "" {
return false, errors.New("description cannot be empty")
}
return true, nil
}