Ptr helpers for enum types

This commit is contained in:
Max Cherry
2017-10-19 21:29:06 +03:00
parent 20dc311b23
commit cfec10564b
7 changed files with 38 additions and 4 deletions
+5
View File
@@ -18,3 +18,8 @@ const (
AdPositionSidebar AdPosition = 6 // Sidebar
AdPositionFullScreen AdPosition = 7 // Full Screen
)
// PtrAdPosition returns pointer to passed argument.
func PtrAdPosition(p AdPosition) *AdPosition {
return &p
}
+5
View File
@@ -14,3 +14,8 @@ const (
ConnectionTypeCellularNetwork3G ConnectionType = 5 // Cellular Network 3G
ConnectionTypeCellularNetwork4G ConnectionType = 6 // Cellular Network 4G
)
// PtrConnectionType returns pointer to passed argument.
func PtrConnectionType(t ConnectionType) *ConnectionType {
return &t
}
+5
View File
@@ -18,3 +18,8 @@ const (
NoBidReasonCodeDailyReaderCapMet NoBidReasonCode = 9 // Daily Reader Cap Met
NoBidReasonCodeDailyDomainCapMet NoBidReasonCode = 10 // Daily Domain Cap Met
)
// PtrNoBidReasonCode returns pointer to passed argument.
func PtrNoBidReasonCode(c NoBidReasonCode) *NoBidReasonCode {
return &c
}
+5
View File
@@ -12,3 +12,8 @@ const (
ProductionQualityProsumer ProductionQuality = 2 // Prosumer
ProductionQualityUserGenerated ProductionQuality = 3 // User Generated (UGC)
)
// PtrProductionQuality returns pointer to passed argument.
func PtrProductionQuality(q ProductionQuality) *ProductionQuality {
return &q
}
+8 -4
View File
@@ -1,7 +1,11 @@
package openrtb
// PtrInt8 returns pointer to passed number argument.
func PtrInt8(n int8) *int8 { return &n }
// PtrInt8 returns pointer to passed argument.
func PtrInt8(n int8) *int8 {
return &n
}
// PtrUint64 returns pointer to passed number argument.
func PtrUint64(n uint64) *uint64 { return &n }
// PtrUint64 returns pointer to passed argument.
func PtrUint64(n uint64) *uint64 {
return &n
}
+5
View File
@@ -13,3 +13,8 @@ const (
StartDelayGenericMidRoll StartDelay = -1 // Generic Mid-Roll
StartDelayGenericPostRoll StartDelay = -2 // Generic Post-Roll
)
// PtrStartDelay returns pointer to passed argument.
func PtrStartDelay(d StartDelay) *StartDelay {
return &d
}
+5
View File
@@ -12,3 +12,8 @@ const (
VolumeNormalizationModeAdLoudnessNormalizedToContent VolumeNormalizationMode = 3 // Ad Loudness Normalized to Content
VolumeNormalizationModeCustomVolumeNormalizationMode VolumeNormalizationMode = 4 // Custom Volume Normalization
)
// PtrVolumeNormalizationMode returns pointer to passed argument.
func PtrVolumeNormalizationMode(m VolumeNormalizationMode) *VolumeNormalizationMode {
return &m
}