Fix constraints and add doc

This commit is contained in:
Emile Vauge 2016-09-20 16:56:29 +02:00
parent 89fc835bb2
commit a882a9d79f
No known key found for this signature in database
GPG key ID: D808B4C167352E59
4 changed files with 89 additions and 44 deletions

View file

@ -139,6 +139,13 @@ func (c *Constraint) String() string {
return c.Key + "!=" + c.Regex
}
// UnmarshalText define how unmarshal in TOML parsing
func (c *Constraint) UnmarshalText(text []byte) error {
constraint, err := NewConstraint(string(text))
*c = *constraint
return err
}
// MatchConstraintWithAtLeastOneTag tests a constraint for one single service
func (c *Constraint) MatchConstraintWithAtLeastOneTag(tags []string) bool {
for _, tag := range tags {