burrow: github.com/hyperledger/burrow/deploy/def/rule Index | Files

package rule

import "github.com/hyperledger/burrow/deploy/def/rule"

Index

Package Files

rules.go

Variables

var (
    Placeholder = validation.Match(PlaceholderRegex).Error("must be a variable placeholder like $marmotVariable")

    Address = validation.NewStringRule(IsAddress,
        fmt.Sprintf("must be valid 20 byte hex-encoded string like '%v'", exampleAddress))

    AddressOrPlaceholder = Or(Placeholder, Address)

    Relation = validation.In("eq", "ne", "ge", "gt", "le", "lt", "==", "!=", ">=", ">", "<=", "<")

    PermissionOrPlaceholder = Or(Placeholder, Permission)

    Permission = validation.By(func(value interface{}) error {
        str, err := validation.EnsureString(value)
        if err != nil {
            return fmt.Errorf("must be a permission name, but %v is not a string", value)
        }
        _, err = permission.PermStringToFlag(str)
        if err != nil {
            return err
        }
        return nil
    })

    Uint64OrPlaceholder = Or(Placeholder, Uint64)

    Uint64 = validation.By(func(value interface{}) error {
        str, err := validation.EnsureString(value)
        if err != nil {
            return fmt.Errorf("should be a numeric string but '%v' is not a string", value)
        }
        _, err = strconv.ParseUint(str, 10, 64)
        if err != nil {
            return fmt.Errorf("should be a 64 bit unsigned integer: ")
        }
        return nil
    })
)

Rules

var PlaceholderRegex = regexp.MustCompile(`\$(?P<bracket>{?)(?P<job>[[:word:]]+)(\.(?P<variable>[[:word:]]+))?}?`)

func Exactly Uses

func Exactly(identity interface{}) validation.Rule

func IsAddress Uses

func IsAddress(value string) bool

func IsOmitted Uses

func IsOmitted(value interface{}) bool

Returns true IFF value is zero value or has length 0

func New Uses

func New(isValid func(value interface{}) bool, message string, args ...interface{}) *boolRule

func Or Uses

func Or(rules ...validation.Rule) *orRule

type PlaceholderMatch Uses

type PlaceholderMatch struct {
    Match        string
    JobName      string
    VariableName string
}

func MatchPlaceholders Uses

func MatchPlaceholders(str string) []PlaceholderMatch

func NewPlaceholderMatch Uses

func NewPlaceholderMatch(match []string) (pm PlaceholderMatch)

func (PlaceholderMatch) IsMatch Uses

func (pm PlaceholderMatch) IsMatch() bool

func (PlaceholderMatch) String Uses

func (pm PlaceholderMatch) String() string

Package rule imports 10 packages (graph) and is imported by 8 packages. Updated 2019-11-14. Refresh now. Tools for package owners.