Skip to content

Commit

Permalink
Replace loop with HasSuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
dranikpg committed Jul 4, 2022
1 parent bd1294d commit 2112d28
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions document_meta.go
Expand Up @@ -362,12 +362,8 @@ func isEmbedded(sf reflect.StructField) bool {
if sf.Anonymous {
return true
}
// search for embedded tag
tags := strings.Split(sf.Tag.Get("db"), ",")
for i, tag := range tags {
if tag == "embedded" && i > 0 {
return true
}
if tag := sf.Tag.Get("db"); strings.HasSuffix(tag, ",embedded") {
return true
}
return false
}
Expand Down

0 comments on commit 2112d28

Please sign in to comment.