forked from TrueCloudLab/neoneo-go
smartcontract: ignore case in trigger.FromString
This commit is contained in:
parent
d6992cb5c4
commit
251a660b85
1 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,9 @@
|
||||||
package trigger
|
package trigger
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
//go:generate stringer -type=Type -output=trigger_type_string.go
|
//go:generate stringer -type=Type -output=trigger_type_string.go
|
||||||
|
|
||||||
|
@ -40,8 +43,9 @@ const (
|
||||||
// FromString converts string to trigger Type
|
// FromString converts string to trigger Type
|
||||||
func FromString(str string) (Type, error) {
|
func FromString(str string) (Type, error) {
|
||||||
triggers := []Type{OnPersist, PostPersist, Verification, Application, All}
|
triggers := []Type{OnPersist, PostPersist, Verification, Application, All}
|
||||||
|
str = strings.ToLower(str)
|
||||||
for _, t := range triggers {
|
for _, t := range triggers {
|
||||||
if t.String() == str {
|
if strings.ToLower(t.String()) == str {
|
||||||
return t, nil
|
return t, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue