diff --git a/schema/notify/prio/flags.go b/schema/notify/prio/flags.go new file mode 100644 index 0000000..9547975 --- /dev/null +++ b/schema/notify/prio/flags.go @@ -0,0 +1,30 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package prio + +import ( + "strconv" + "strings" +) + +const ( + NULL Priority = 0 + MASTER Priority = 255 +) + +func ParsePriority(i string) Priority { + i = strings.TrimSpace(i) + + p, err := strconv.ParseUint(i, 10, 8) + if err != nil { + return NULL + } + + return Priority(p) +} + +type Priority uint8