github.com/prebid/prebid-server/v2@v2.18.0/privacy/gpp/sid.go (about) 1 package gpp 2 3 import ( 4 gpplib "github.com/prebid/go-gpp" 5 gppConstants "github.com/prebid/go-gpp/constants" 6 ) 7 8 // IsSIDInList returns true if the 'sid' value is found in the gppSIDs array. Its logic is used in more than 9 // one place in our codebase, therefore it was decided to make it its own function. 10 func IsSIDInList(gppSIDs []int8, sid gppConstants.SectionID) bool { 11 for _, id := range gppSIDs { 12 if id == int8(sid) { 13 return true 14 } 15 } 16 return false 17 } 18 19 // IndexOfSID returns a zero or non-negative integer that represents the position of 20 // the 'sid' value in the 'gpp.SectionTypes' array. If the 'sid' value is not found, 21 // returns -1. This logic is used in more than one place in our codebase, therefore 22 // it was decided to make it its own function. 23 func IndexOfSID(gpp gpplib.GppContainer, sid gppConstants.SectionID) int { 24 for i, id := range gpp.SectionTypes { 25 if id == sid { 26 return i 27 } 28 } 29 return -1 30 }