Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Eyup-Devop committed Jan 5, 2024
1 parent c2f8827 commit b3e353f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,25 @@ func Ttl(fl validator.FieldLevel) bool {
}

func Priority(fl validator.FieldLevel) bool {
if fl.Parent().FieldByName("RecordType").Elem().IsNil() ||
fl.Parent().FieldByName("RecordType").Elem().String() == "MX" ||
if !fl.Parent().FieldByName("RecordType").IsValid() {
return true
}
if fl.Parent().FieldByName("RecordType").Elem().String() == "MX" ||
fl.Parent().FieldByName("RecordType").Elem().String() == "SRV" {
return true
}
return false
}

func Weight(fl validator.FieldLevel) bool {
if fl.Parent().FieldByName("RecordType").Elem().IsNil() {
if !fl.Parent().FieldByName("RecordType").IsValid() {
return true
}
return fl.Parent().FieldByName("RecordType").Elem().String() == "SRV"
}

func Port(fl validator.FieldLevel) bool {
if fl.Parent().FieldByName("RecordType").Elem().IsNil() {
if !fl.Parent().FieldByName("RecordType").IsValid() {
return true
}
return fl.Parent().FieldByName("RecordType").Elem().String() == "SRV"
Expand Down

0 comments on commit b3e353f

Please sign in to comment.