From 318c132d234dfe0f91bb9c42ce881d4fb30440ca Mon Sep 17 00:00:00 2001 From: Max Cherry Date: Sun, 30 Dec 2018 12:33:17 +0200 Subject: [PATCH 1/7] types: get rid of 16-bit int/uint --- adcom1/content.go | 2 +- adcom1/device.go | 2 +- adcom1/dooh.go | 2 +- adcom1/user.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adcom1/content.go b/adcom1/content.go index ceaaa34..164cd3f 100644 --- a/adcom1/content.go +++ b/adcom1/content.go @@ -20,7 +20,7 @@ type Content struct { // integer // Definition: // Episode number. - Episode uint16 `json:"episode,omitempty"` + Episode int `json:"episode,omitempty"` // Attribute: // title diff --git a/adcom1/device.go b/adcom1/device.go index 9a21e92..69c42c0 100644 --- a/adcom1/device.go +++ b/adcom1/device.go @@ -111,7 +111,7 @@ type Device struct { // integer // Definition: // Screen size as pixels per linear inch. - PPI uint16 `json:"ppi,omitempty"` + PPI int `json:"ppi,omitempty"` // Attribute: // pxratio diff --git a/adcom1/dooh.go b/adcom1/dooh.go index 8c487d4..e3ecac1 100644 --- a/adcom1/dooh.go +++ b/adcom1/dooh.go @@ -38,7 +38,7 @@ type DOOH struct { // integer // Definition: // Minimum DPI for text-based creative elements to display clearly. - DPI uint16 `json:"dpi,omitempty"` + DPI int `json:"dpi,omitempty"` // Attribute: // ext diff --git a/adcom1/user.go b/adcom1/user.go index e459c17..4d02900 100644 --- a/adcom1/user.go +++ b/adcom1/user.go @@ -30,7 +30,7 @@ type User struct { // integer // Definition: // Year of birth as a 4-digit integer. - YOB uint16 `json:"yob,omitempty"` + YOB int `json:"yob,omitempty"` // Attribute: // gender From ca66729d83c33c9d39a5d4f3feacee28e6a8d9ae Mon Sep 17 00:00:00 2001 From: Max Cherry Date: Sun, 30 Dec 2018 12:37:55 +0200 Subject: [PATCH 2/7] types: get rid of uint64 (int will do) --- adcom1/audio_placement.go | 4 ++-- adcom1/device.go | 4 ++-- adcom1/display.go | 4 ++-- adcom1/display_format.go | 4 ++-- adcom1/display_placement.go | 4 ++-- adcom1/image_asset.go | 4 ++-- adcom1/image_asset_format.go | 8 ++++---- adcom1/video_placement.go | 8 ++++---- native1/request/image.go | 8 ++++---- native1/response/image.go | 4 ++-- openrtb2/audio.go | 8 ++++---- openrtb2/banner.go | 12 ++++++------ openrtb2/bid.go | 8 ++++---- openrtb2/content.go | 2 +- openrtb2/device.go | 6 +++--- openrtb2/format.go | 10 +++++----- openrtb2/geo.go | 2 +- openrtb2/ptr.go | 2 +- openrtb2/video.go | 8 ++++---- 19 files changed, 55 insertions(+), 55 deletions(-) diff --git a/adcom1/audio_placement.go b/adcom1/audio_placement.go index 1eeb604..a8b6d77 100644 --- a/adcom1/audio_placement.go +++ b/adcom1/audio_placement.go @@ -134,7 +134,7 @@ type AudioPlacement struct { // integer // Definition: // Minimum bit rate of the creative in Kbps. - MinBitR uint64 `json:"minbitr,omitempty"` + MinBitR int `json:"minbitr,omitempty"` // Attribute: // maxbitr @@ -142,7 +142,7 @@ type AudioPlacement struct { // integer // Definition: // Maximum bit rate of the creative in Kbps. - MaxBitR uint64 `json:"maxbitr,omitempty"` + MaxBitR int `json:"maxbitr,omitempty"` // Attribute: // delivery diff --git a/adcom1/device.go b/adcom1/device.go index 69c42c0..99eb4ca 100644 --- a/adcom1/device.go +++ b/adcom1/device.go @@ -95,7 +95,7 @@ type Device struct { // integer // Definition: // Physical height of the screen in pixels. - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // w @@ -103,7 +103,7 @@ type Device struct { // integer // Definition: // Physical width of the screen in pixels. - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // ppi diff --git a/adcom1/display.go b/adcom1/display.go index 638781b..93d4dd3 100644 --- a/adcom1/display.go +++ b/adcom1/display.go @@ -40,7 +40,7 @@ type Display struct { // Definition: // Absolute width of the creative in device independent pixels (DIPS), typically for non-native ads. // Note that mixing absolute and relative sizes is not recommended. - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // h @@ -49,7 +49,7 @@ type Display struct { // Definition: // Absolute height of the creative in device independent pixels (DIPS), typically for non-native ads. // Note that mixing absolute and relative sizes is not recommended. - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // wratio diff --git a/adcom1/display_format.go b/adcom1/display_format.go index 1180445..2e42fc9 100644 --- a/adcom1/display_format.go +++ b/adcom1/display_format.go @@ -11,7 +11,7 @@ type DisplayFormat struct { // Definition: // Absolute width of the creative in units specified by DisplayPlacement.unit. // Note that mixing absolute and relative sizes is not recommended. - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // h @@ -20,7 +20,7 @@ type DisplayFormat struct { // Definition: // Absolute height of the creative in units specified by DisplayPlacement.unit. // Note that mixing absolute and relative sizes is not recommended. - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // wratio diff --git a/adcom1/display_placement.go b/adcom1/display_placement.go index f0064c3..01a7fca 100644 --- a/adcom1/display_placement.go +++ b/adcom1/display_placement.go @@ -110,7 +110,7 @@ type DisplayPlacement struct { // Definition: // Width of the placement in units specified by unit. // Note that this size applies to the placement itself; permitted creative sizes are specified elsewhere (e.g., DisplayFormat, ImageAssetFormat, etc.). - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // h @@ -119,7 +119,7 @@ type DisplayPlacement struct { // Definition: // Width of the placement in units specified by unit. // Note that this size applies to the placement itself; permitted creative sizes are specified elsewhere (e.g., DisplayFormat, ImageAssetFormat, etc.). - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // unit diff --git a/adcom1/image_asset.go b/adcom1/image_asset.go index 0b686b4..f6f5cd9 100644 --- a/adcom1/image_asset.go +++ b/adcom1/image_asset.go @@ -19,7 +19,7 @@ type ImageAsset struct { // integer; recommended // Definition: // Width of the image asset in device independent pixels (DIPS). - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // h @@ -27,7 +27,7 @@ type ImageAsset struct { // integer; recommended // Definition: // Height of the image asset in device independent pixels (DIPS). - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // type diff --git a/adcom1/image_asset_format.go b/adcom1/image_asset_format.go index 4682ab0..d9eeae5 100644 --- a/adcom1/image_asset_format.go +++ b/adcom1/image_asset_format.go @@ -30,7 +30,7 @@ type ImageAssetFormat struct { // Definition: // Absolute width of the image asset in device independent pixels (DIPS). // Note that mixing absolute and relative sizes is not recommended. - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // h @@ -39,7 +39,7 @@ type ImageAssetFormat struct { // Definition: // Absolute height of the image asset in device independent pixels (DIPS). // Note that mixing absolute and relative sizes is not recommended. - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // wmin @@ -48,7 +48,7 @@ type ImageAssetFormat struct { // Definition: // The minimum requested absolute width of the image in device independent pixels (DIPS). // This option should be used for any scaling of images by the client. - WMin uint64 `json:"wmin,omitempty"` + WMin int `json:"wmin,omitempty"` // Attribute: // hmin @@ -57,7 +57,7 @@ type ImageAssetFormat struct { // Definition: // The minimum requested absolute height of the image in device independent pixels (DIPS). // This option should be used for any scaling of images by the client. - HMin uint64 `json:"hmin,omitempty"` + HMin int `json:"hmin,omitempty"` // Attribute: // wratio diff --git a/adcom1/video_placement.go b/adcom1/video_placement.go index 726febb..8469064 100644 --- a/adcom1/video_placement.go +++ b/adcom1/video_placement.go @@ -116,7 +116,7 @@ type VideoPlacement struct { // integer // Definition: // Width of the placement in units specified by unit. - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // h @@ -124,7 +124,7 @@ type VideoPlacement struct { // integer // Definition: // Height of the placement in units specified by unit. - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // unit @@ -168,7 +168,7 @@ type VideoPlacement struct { // integer // Definition: // Minimum bit rate of the creative in Kbps. - MinBitR uint64 `json:"minbitr,omitempty"` + MinBitR int `json:"minbitr,omitempty"` // Attribute: // maxbitr @@ -176,7 +176,7 @@ type VideoPlacement struct { // integer // Definition: // Maximum bit rate of the creative in Kbps. - MaxBitR uint64 `json:"maxbitr,omitempty"` + MaxBitR int `json:"maxbitr,omitempty"` // Attribute: // delivery diff --git a/native1/request/image.go b/native1/request/image.go index d7d7830..dc0e8dd 100644 --- a/native1/request/image.go +++ b/native1/request/image.go @@ -32,7 +32,7 @@ type Image struct { // integer // Description: // Width of the image in pixels. - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Field: // wmin @@ -45,7 +45,7 @@ type Image struct { // This option should be used for any rescaling of images by the client. // Either w or wmin should be transmitted. // If only w is included, it should be considered an exact requirement. - WMin uint64 `json:"wmin,omitempty"` + WMin int `json:"wmin,omitempty"` // Field: // h @@ -55,7 +55,7 @@ type Image struct { // integer // Description: // Height of the image in pixels. - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Field: // hmin @@ -68,7 +68,7 @@ type Image struct { // This option should be used for any rescaling of images by the client. // Either h or hmin should be transmitted. // If only h is included, it should be considered an exact requirement. - HMin uint64 `json:"hmin,omitempty"` + HMin int `json:"hmin,omitempty"` // Field: // mimes diff --git a/native1/response/image.go b/native1/response/image.go index 0ae83c4..a5007a2 100644 --- a/native1/response/image.go +++ b/native1/response/image.go @@ -44,7 +44,7 @@ type Image struct { // Width of the image in pixels. // Recommended for embedded asset responses. // Required for assetsurl/dcourlresponses if multiple assets of same type submitted. - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Field: // h @@ -56,7 +56,7 @@ type Image struct { // Height of the image in pixels. // Recommended for embedded asset responses. // Required for assetsurl/dcourl responses if multiple assets of same type submitted. - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Field: // ext diff --git a/openrtb2/audio.go b/openrtb2/audio.go index 9eec597..31fc957 100644 --- a/openrtb2/audio.go +++ b/openrtb2/audio.go @@ -63,7 +63,7 @@ type Audio struct { // If multiple ad impressions are offered in the same bid request, // the sequence number will allow for the coordinated delivery // of multiple creatives. - Sequence uint64 `json:"sequence,omitempty"` + Sequence int `json:"sequence,omitempty"` // Attribute: // battr @@ -91,7 +91,7 @@ type Audio struct { // integer // Description: // Minimum bit rate in Kbps. - MinBitrate uint64 `json:"minbitrate,omitempty"` + MinBitrate int `json:"minbitrate,omitempty"` // Attribute: // maxbitrate @@ -99,7 +99,7 @@ type Audio struct { // integer // Description: // Maximum bit rate in Kbps. - MaxBitrate uint64 `json:"maxbitrate,omitempty"` + MaxBitrate int `json:"maxbitrate,omitempty"` // Attribute: // delivery @@ -147,7 +147,7 @@ type Audio struct { // The maximum number of ads that can be played in an ad pod. // OpenRTB API Specification Version 2.5 IAB Technology Lab // www.iab.com/openrtb Page 18 - MaxSeq uint64 `json:"maxseq,omitempty"` + MaxSeq int `json:"maxseq,omitempty"` // Attribute: // feed diff --git a/openrtb2/banner.go b/openrtb2/banner.go index 2005be7..dbb1281 100644 --- a/openrtb2/banner.go +++ b/openrtb2/banner.go @@ -30,7 +30,7 @@ type Banner struct { // Description: // Exact width in device independent pixels (DIPS); // recommended if no format objects are specified. - W *uint64 `json:"w,omitempty"` + W *int `json:"w,omitempty"` // Attribute: // h @@ -39,7 +39,7 @@ type Banner struct { // Description: // Exact height in device independent pixels (DIPS); // recommended if no format objects are specified. - H *uint64 `json:"h,omitempty"` + H *int `json:"h,omitempty"` // Attribute: // wmax @@ -48,7 +48,7 @@ type Banner struct { // Description: // NOTE: Deprecated in favor of the format array. // Maximum width in device independent pixels (DIPS). - WMax uint64 `json:"wmax,omitempty"` + WMax int `json:"wmax,omitempty"` // Attribute: // hmax @@ -57,7 +57,7 @@ type Banner struct { // Description: // NOTE: Deprecated in favor of the format array. // Maximum height in device independent pixels (DIPS). - HMax uint64 `json:"hmax,omitempty"` + HMax int `json:"hmax,omitempty"` // Attribute: // wmin @@ -66,7 +66,7 @@ type Banner struct { // Description: // NOTE: Deprecated in favor of the format array. // Minimum width in device independent pixels (DIPS). - WMin uint64 `json:"wmin,omitempty"` + WMin int `json:"wmin,omitempty"` // Attribute: // hmin @@ -75,7 +75,7 @@ type Banner struct { // Description: // NOTE: Deprecated in favor of the format array. // Minimum height in device independent pixels (DIPS). - HMin uint64 `json:"hmin,omitempty"` + HMin int `json:"hmin,omitempty"` // Attribute: // btype diff --git a/openrtb2/bid.go b/openrtb2/bid.go index 47c47a9..3a067d9 100644 --- a/openrtb2/bid.go +++ b/openrtb2/bid.go @@ -232,7 +232,7 @@ type Bid struct { // integer // Description: // Width of the creative in device independent pixels (DIPS). - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // h @@ -240,7 +240,7 @@ type Bid struct { // integer // Description: // Height of the creative in device independent pixels (DIPS). - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // wratio @@ -249,7 +249,7 @@ type Bid struct { // Description: // Relative width of the creative when expressing size as a ratio. // Required for Flex Ads. - WRatio uint64 `json:"wratio,omitempty"` + WRatio int `json:"wratio,omitempty"` // Attribute: // hratio @@ -258,7 +258,7 @@ type Bid struct { // Description: // Relative height of the creative when expressing size as a ratio. // Required for Flex Ads. - HRatio uint64 `json:"hratio,omitempty"` + HRatio int `json:"hratio,omitempty"` // Attribute: // exp diff --git a/openrtb2/content.go b/openrtb2/content.go index 8790e73..b936be1 100644 --- a/openrtb2/content.go +++ b/openrtb2/content.go @@ -24,7 +24,7 @@ type Content struct { // integer // Description: // Episode number. - Episode uint64 `json:"episode,omitempty"` + Episode int `json:"episode,omitempty"` // Attribute: // title diff --git a/openrtb2/device.go b/openrtb2/device.go index 5128f26..a8a6c7b 100644 --- a/openrtb2/device.go +++ b/openrtb2/device.go @@ -123,7 +123,7 @@ type Device struct { // integer // Description: // Physical height of the screen in pixels. - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // w @@ -131,7 +131,7 @@ type Device struct { // integer // Description: // Physical width of the screen in pixels. - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // ppi @@ -139,7 +139,7 @@ type Device struct { // integer // Description: // Screen size as pixels per linear inch. - PPI uint64 `json:"ppi,omitempty"` + PPI int `json:"ppi,omitempty"` // Attribute: // pxratio diff --git a/openrtb2/format.go b/openrtb2/format.go index 6628348..ab0acbf 100644 --- a/openrtb2/format.go +++ b/openrtb2/format.go @@ -15,7 +15,7 @@ type Format struct { // integer // Description: // Width in device independent pixels (DIPS). - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // h @@ -23,7 +23,7 @@ type Format struct { // integer // Description: // Height in device independent pixels (DIPS). - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // wratio @@ -31,7 +31,7 @@ type Format struct { // integer // Description: // Relative width when expressing size as a ratio - WRatio uint64 `json:"wratio,omitempty"` + WRatio int `json:"wratio,omitempty"` // Attribute: // hratio @@ -39,7 +39,7 @@ type Format struct { // Integer // Description: // Relative height when expressing size as a ratio. - HRatio uint64 `json:"hratio,omitempty"` + HRatio int `json:"hratio,omitempty"` // Attribute: // wmin @@ -48,7 +48,7 @@ type Format struct { // Description: // The minimum width in device independent pixels (DIPS) at // which the ad will be displayed the size is expressed as a ratio. - WMin uint64 `json:"wmin,omitempty"` + WMin int `json:"wmin,omitempty"` // Attribute: // ext diff --git a/openrtb2/geo.go b/openrtb2/geo.go index cad1ee3..ed3cc37 100644 --- a/openrtb2/geo.go +++ b/openrtb2/geo.go @@ -48,7 +48,7 @@ type Geo struct { // services (i.e., type = 1). Note that this is the accuracy as // reported from the device. Consult OS specific documentation // (e.g., Android, iOS) for exact interpretation. - Accuracy uint64 `json:"accuracy,omitempty"` + Accuracy int `json:"accuracy,omitempty"` // Attribute: // lastfix diff --git a/openrtb2/ptr.go b/openrtb2/ptr.go index 4b6d364..738d538 100644 --- a/openrtb2/ptr.go +++ b/openrtb2/ptr.go @@ -6,6 +6,6 @@ func Int8Ptr(n int8) *int8 { } // Uint64Ptr returns pointer to passed argument. -func Uint64Ptr(n uint64) *uint64 { +func Uint64Ptr(n int) *int { return &n } diff --git a/openrtb2/video.go b/openrtb2/video.go index 488411e..b90c058 100644 --- a/openrtb2/video.go +++ b/openrtb2/video.go @@ -66,7 +66,7 @@ type Video struct { // integer; recommended // Description: // Width of the video player in device independent pixels (DIPS). - W uint64 `json:"w,omitempty"` + W int `json:"w,omitempty"` // Attribute: // h @@ -74,7 +74,7 @@ type Video struct { // integer; recommended // Description: // Height of the video player in device independent pixels (DIPS). - H uint64 `json:"h,omitempty"` + H int `json:"h,omitempty"` // Attribute: // startdelay @@ -169,7 +169,7 @@ type Video struct { // integer // Description: // Minimum bit rate in Kbps. - MinBitRate uint64 `json:"minbitrate,omitempty"` + MinBitRate int `json:"minbitrate,omitempty"` // Attribute: // maxbitrate @@ -177,7 +177,7 @@ type Video struct { // integer // Description: // Maximum bit rate in Kbps. - MaxBitRate uint64 `json:"maxbitrate,omitempty"` + MaxBitRate int `json:"maxbitrate,omitempty"` // Attribute: // boxingallowed From 3682b9ade10c4c080efa18ff8f645787e3f56125 Mon Sep 17 00:00:00 2001 From: Max Cherry Date: Sun, 30 Dec 2018 12:40:26 +0200 Subject: [PATCH 3/7] types: get rid of uint8 (int8 should do) --- adcom1/display.go | 8 ++++---- adcom1/display_format.go | 8 ++++---- adcom1/image_asset_format.go | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/adcom1/display.go b/adcom1/display.go index 93d4dd3..e246a12 100644 --- a/adcom1/display.go +++ b/adcom1/display.go @@ -59,8 +59,8 @@ type Display struct { // Relative width of the creative when expressing size as a ratio, typically for non-native ads. // Note that mixing absolute and relative sizes is not recommended. // Dev note: - // This is kept as `uint8` because ratio values are expected to be quite small (like 16:9). - WRatio uint8 `json:"wratio,omitempty"` + // This is kept as `int8` because ratio values are expected to be quite small (like 16:9). + WRatio int8 `json:"wratio,omitempty"` // Attribute: // hratio @@ -70,8 +70,8 @@ type Display struct { // Relative height of the creative when expressing size as a ratio, typically for non-native ads. // Note that mixing absolute and relative sizes is not recommended. // Dev note: - // This is kept as `uint8` because ratio values are expected to be quite small (like 16:9). - HRatio uint8 `json:"hratio,omitempty"` + // This is kept as `int8` because ratio values are expected to be quite small (like 16:9). + HRatio int8 `json:"hratio,omitempty"` // Attribute: // priv diff --git a/adcom1/display_format.go b/adcom1/display_format.go index 2e42fc9..caa9836 100644 --- a/adcom1/display_format.go +++ b/adcom1/display_format.go @@ -30,8 +30,8 @@ type DisplayFormat struct { // Relative width of the creative when expressing size as a ratio. // Note that mixing absolute and relative sizes is not recommended. // Dev note: - // This is kept as `uint8` because ratio values are expected to be quite small (like 16:9). - WRatio uint8 `json:"wratio,omitempty"` + // This is kept as `int8` because ratio values are expected to be quite small (like 16:9). + WRatio int8 `json:"wratio,omitempty"` // Attribute: // hratio @@ -41,8 +41,8 @@ type DisplayFormat struct { // Relative height of the creative when expressing size as a ratio. // Note that mixing absolute and relative sizes is not recommended. // Dev note: - // This is kept as `uint8` because ratio values are expected to be quite small (like 16:9). - HRatio uint8 `json:"hratio,omitempty"` + // This is kept as `int8` because ratio values are expected to be quite small (like 16:9). + HRatio int8 `json:"hratio,omitempty"` // Attribute: // expdir diff --git a/adcom1/image_asset_format.go b/adcom1/image_asset_format.go index d9eeae5..9f379a1 100644 --- a/adcom1/image_asset_format.go +++ b/adcom1/image_asset_format.go @@ -67,8 +67,8 @@ type ImageAssetFormat struct { // Relative width of the image asset when expressing size as a ratio. // Note that mixing absolute and relative sizes is not recommended. // Dev note: - // This is kept as `uint8` because ratio values are expected to be quite small (like 16:9). - WRatio uint8 `json:"wratio,omitempty"` + // This is kept as `int8` because ratio values are expected to be quite small (like 16:9). + WRatio int8 `json:"wratio,omitempty"` // Attribute: // hratio @@ -78,8 +78,8 @@ type ImageAssetFormat struct { // Relative height of the image asset when expressing size as a ratio. // Note that mixing absolute and relative sizes is not recommended. // Dev note: - // This is kept as `uint8` because ratio values are expected to be quite small (like 16:9). - HRatio uint8 `json:"hratio,omitempty"` + // This is kept as `int8` because ratio values are expected to be quite small (like 16:9). + HRatio int8 `json:"hratio,omitempty"` // Attribute: // ext From 1efc8682573c270ce7806cdc00203fc4194a3048 Mon Sep 17 00:00:00 2001 From: Max Cherry Date: Sun, 30 Dec 2018 12:42:33 +0200 Subject: [PATCH 4/7] types: actually, better stick to int64 instead of just int At least, it's more convenient to use with time std pkg. Also, API implementations better never rely on machine-dependent types. --- adcom1/audio_placement.go | 6 +++--- adcom1/content.go | 2 +- adcom1/data_asset.go | 2 +- adcom1/data_asset_format.go | 2 +- adcom1/device.go | 6 +++--- adcom1/display.go | 4 ++-- adcom1/display_format.go | 4 ++-- adcom1/display_placement.go | 4 ++-- adcom1/dooh.go | 2 +- adcom1/geo.go | 2 +- adcom1/image_asset.go | 4 ++-- adcom1/image_asset_format.go | 8 ++++---- adcom1/title_asset.go | 2 +- adcom1/title_asset_format.go | 2 +- adcom1/user.go | 2 +- adcom1/video_placement.go | 10 +++++----- native1/request/image.go | 8 ++++---- native1/response/image.go | 4 ++-- openrtb2/audio.go | 8 ++++---- openrtb2/banner.go | 12 ++++++------ openrtb2/bid.go | 8 ++++---- openrtb2/content.go | 2 +- openrtb2/device.go | 6 +++--- openrtb2/format.go | 10 +++++----- openrtb2/geo.go | 2 +- openrtb2/ptr.go | 2 +- openrtb2/video.go | 8 ++++---- openrtb3/item.go | 4 ++-- 28 files changed, 68 insertions(+), 68 deletions(-) diff --git a/adcom1/audio_placement.go b/adcom1/audio_placement.go index a8b6d77..58654ad 100644 --- a/adcom1/audio_placement.go +++ b/adcom1/audio_placement.go @@ -134,7 +134,7 @@ type AudioPlacement struct { // integer // Definition: // Minimum bit rate of the creative in Kbps. - MinBitR int `json:"minbitr,omitempty"` + MinBitR int64 `json:"minbitr,omitempty"` // Attribute: // maxbitr @@ -142,7 +142,7 @@ type AudioPlacement struct { // integer // Definition: // Maximum bit rate of the creative in Kbps. - MaxBitR int `json:"maxbitr,omitempty"` + MaxBitR int64 `json:"maxbitr,omitempty"` // Attribute: // delivery @@ -160,7 +160,7 @@ type AudioPlacement struct { // integer // Definition: // The maximum number of ads that can be played in an ad pod. - MaxSeq int `json:"maxseq,omitempty"` + MaxSeq int64 `json:"maxseq,omitempty"` // Attribute: // comp diff --git a/adcom1/content.go b/adcom1/content.go index 164cd3f..701363b 100644 --- a/adcom1/content.go +++ b/adcom1/content.go @@ -20,7 +20,7 @@ type Content struct { // integer // Definition: // Episode number. - Episode int `json:"episode,omitempty"` + Episode int64 `json:"episode,omitempty"` // Attribute: // title diff --git a/adcom1/data_asset.go b/adcom1/data_asset.go index ab63f5a..c6b73c0 100644 --- a/adcom1/data_asset.go +++ b/adcom1/data_asset.go @@ -21,7 +21,7 @@ type DataAsset struct { // Definition: // The length of the value contents. // This length should conform to recommendations provided in List: Native Data Asset Types - Len int `json:"len,omitempty"` + Len int64 `json:"len,omitempty"` // Attribute: // type diff --git a/adcom1/data_asset_format.go b/adcom1/data_asset_format.go index 92ddaa8..8ec7f1b 100644 --- a/adcom1/data_asset_format.go +++ b/adcom1/data_asset_format.go @@ -21,7 +21,7 @@ type DataAssetFormat struct { // integer // Definition: // The maximum allowed length of the data value. - Len int `json:"len,omitempty"` + Len int64 `json:"len,omitempty"` // Attribute: // ext diff --git a/adcom1/device.go b/adcom1/device.go index 99eb4ca..58e09d3 100644 --- a/adcom1/device.go +++ b/adcom1/device.go @@ -95,7 +95,7 @@ type Device struct { // integer // Definition: // Physical height of the screen in pixels. - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // w @@ -103,7 +103,7 @@ type Device struct { // integer // Definition: // Physical width of the screen in pixels. - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // ppi @@ -111,7 +111,7 @@ type Device struct { // integer // Definition: // Screen size as pixels per linear inch. - PPI int `json:"ppi,omitempty"` + PPI int64 `json:"ppi,omitempty"` // Attribute: // pxratio diff --git a/adcom1/display.go b/adcom1/display.go index e246a12..fe78b5b 100644 --- a/adcom1/display.go +++ b/adcom1/display.go @@ -40,7 +40,7 @@ type Display struct { // Definition: // Absolute width of the creative in device independent pixels (DIPS), typically for non-native ads. // Note that mixing absolute and relative sizes is not recommended. - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // h @@ -49,7 +49,7 @@ type Display struct { // Definition: // Absolute height of the creative in device independent pixels (DIPS), typically for non-native ads. // Note that mixing absolute and relative sizes is not recommended. - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // wratio diff --git a/adcom1/display_format.go b/adcom1/display_format.go index caa9836..08273a2 100644 --- a/adcom1/display_format.go +++ b/adcom1/display_format.go @@ -11,7 +11,7 @@ type DisplayFormat struct { // Definition: // Absolute width of the creative in units specified by DisplayPlacement.unit. // Note that mixing absolute and relative sizes is not recommended. - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // h @@ -20,7 +20,7 @@ type DisplayFormat struct { // Definition: // Absolute height of the creative in units specified by DisplayPlacement.unit. // Note that mixing absolute and relative sizes is not recommended. - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // wratio diff --git a/adcom1/display_placement.go b/adcom1/display_placement.go index 01a7fca..36c58bf 100644 --- a/adcom1/display_placement.go +++ b/adcom1/display_placement.go @@ -110,7 +110,7 @@ type DisplayPlacement struct { // Definition: // Width of the placement in units specified by unit. // Note that this size applies to the placement itself; permitted creative sizes are specified elsewhere (e.g., DisplayFormat, ImageAssetFormat, etc.). - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // h @@ -119,7 +119,7 @@ type DisplayPlacement struct { // Definition: // Width of the placement in units specified by unit. // Note that this size applies to the placement itself; permitted creative sizes are specified elsewhere (e.g., DisplayFormat, ImageAssetFormat, etc.). - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // unit diff --git a/adcom1/dooh.go b/adcom1/dooh.go index e3ecac1..9e301ff 100644 --- a/adcom1/dooh.go +++ b/adcom1/dooh.go @@ -38,7 +38,7 @@ type DOOH struct { // integer // Definition: // Minimum DPI for text-based creative elements to display clearly. - DPI int `json:"dpi,omitempty"` + DPI int64 `json:"dpi,omitempty"` // Attribute: // ext diff --git a/adcom1/geo.go b/adcom1/geo.go index ea90812..088fee6 100644 --- a/adcom1/geo.go +++ b/adcom1/geo.go @@ -115,7 +115,7 @@ type Geo struct { // Local time as the number +/- of minutes from UTC. // Dev note: // This field is kept as `int` to follow type choice for timezone offset in std. `time` package. - UTCOffset int `json:"utcoffset,omitempty"` + UTCOffset int64 `json:"utcoffset,omitempty"` // Attribute: // ext diff --git a/adcom1/image_asset.go b/adcom1/image_asset.go index f6f5cd9..b3e7308 100644 --- a/adcom1/image_asset.go +++ b/adcom1/image_asset.go @@ -19,7 +19,7 @@ type ImageAsset struct { // integer; recommended // Definition: // Width of the image asset in device independent pixels (DIPS). - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // h @@ -27,7 +27,7 @@ type ImageAsset struct { // integer; recommended // Definition: // Height of the image asset in device independent pixels (DIPS). - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // type diff --git a/adcom1/image_asset_format.go b/adcom1/image_asset_format.go index 9f379a1..5099fad 100644 --- a/adcom1/image_asset_format.go +++ b/adcom1/image_asset_format.go @@ -30,7 +30,7 @@ type ImageAssetFormat struct { // Definition: // Absolute width of the image asset in device independent pixels (DIPS). // Note that mixing absolute and relative sizes is not recommended. - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // h @@ -39,7 +39,7 @@ type ImageAssetFormat struct { // Definition: // Absolute height of the image asset in device independent pixels (DIPS). // Note that mixing absolute and relative sizes is not recommended. - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // wmin @@ -48,7 +48,7 @@ type ImageAssetFormat struct { // Definition: // The minimum requested absolute width of the image in device independent pixels (DIPS). // This option should be used for any scaling of images by the client. - WMin int `json:"wmin,omitempty"` + WMin int64 `json:"wmin,omitempty"` // Attribute: // hmin @@ -57,7 +57,7 @@ type ImageAssetFormat struct { // Definition: // The minimum requested absolute height of the image in device independent pixels (DIPS). // This option should be used for any scaling of images by the client. - HMin int `json:"hmin,omitempty"` + HMin int64 `json:"hmin,omitempty"` // Attribute: // wratio diff --git a/adcom1/title_asset.go b/adcom1/title_asset.go index b35e1aa..cd51da7 100644 --- a/adcom1/title_asset.go +++ b/adcom1/title_asset.go @@ -18,7 +18,7 @@ type TitleAsset struct { // integer // Definition: // The length of the contents of the text attribute. - Len int `json:"len,omitempty"` + Len int64 `json:"len,omitempty"` // Attribute: // ext diff --git a/adcom1/title_asset_format.go b/adcom1/title_asset_format.go index 92689be..29cce4a 100644 --- a/adcom1/title_asset_format.go +++ b/adcom1/title_asset_format.go @@ -12,7 +12,7 @@ type TitleAssetFormat struct { // Definition: // The maximum allowed length of the title value. // Recommended lengths are 25, 90, or 140. - Len int `json:"len,omitempty"` + Len int64 `json:"len,omitempty"` // Attribute: // ext diff --git a/adcom1/user.go b/adcom1/user.go index 4d02900..a12b096 100644 --- a/adcom1/user.go +++ b/adcom1/user.go @@ -30,7 +30,7 @@ type User struct { // integer // Definition: // Year of birth as a 4-digit integer. - YOB int `json:"yob,omitempty"` + YOB int64 `json:"yob,omitempty"` // Attribute: // gender diff --git a/adcom1/video_placement.go b/adcom1/video_placement.go index 8469064..c89fa53 100644 --- a/adcom1/video_placement.go +++ b/adcom1/video_placement.go @@ -116,7 +116,7 @@ type VideoPlacement struct { // integer // Definition: // Width of the placement in units specified by unit. - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // h @@ -124,7 +124,7 @@ type VideoPlacement struct { // integer // Definition: // Height of the placement in units specified by unit. - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // unit @@ -168,7 +168,7 @@ type VideoPlacement struct { // integer // Definition: // Minimum bit rate of the creative in Kbps. - MinBitR int `json:"minbitr,omitempty"` + MinBitR int64 `json:"minbitr,omitempty"` // Attribute: // maxbitr @@ -176,7 +176,7 @@ type VideoPlacement struct { // integer // Definition: // Maximum bit rate of the creative in Kbps. - MaxBitR int `json:"maxbitr,omitempty"` + MaxBitR int64 `json:"maxbitr,omitempty"` // Attribute: // delivery @@ -194,7 +194,7 @@ type VideoPlacement struct { // integer // Definition: // The maximum number of ads that can be played in an ad pod. - MaxSeq int `json:"maxseq,omitempty"` + MaxSeq int64 `json:"maxseq,omitempty"` // Attribute: // linear diff --git a/native1/request/image.go b/native1/request/image.go index dc0e8dd..a1c29eb 100644 --- a/native1/request/image.go +++ b/native1/request/image.go @@ -32,7 +32,7 @@ type Image struct { // integer // Description: // Width of the image in pixels. - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Field: // wmin @@ -45,7 +45,7 @@ type Image struct { // This option should be used for any rescaling of images by the client. // Either w or wmin should be transmitted. // If only w is included, it should be considered an exact requirement. - WMin int `json:"wmin,omitempty"` + WMin int64 `json:"wmin,omitempty"` // Field: // h @@ -55,7 +55,7 @@ type Image struct { // integer // Description: // Height of the image in pixels. - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Field: // hmin @@ -68,7 +68,7 @@ type Image struct { // This option should be used for any rescaling of images by the client. // Either h or hmin should be transmitted. // If only h is included, it should be considered an exact requirement. - HMin int `json:"hmin,omitempty"` + HMin int64 `json:"hmin,omitempty"` // Field: // mimes diff --git a/native1/response/image.go b/native1/response/image.go index a5007a2..0629515 100644 --- a/native1/response/image.go +++ b/native1/response/image.go @@ -44,7 +44,7 @@ type Image struct { // Width of the image in pixels. // Recommended for embedded asset responses. // Required for assetsurl/dcourlresponses if multiple assets of same type submitted. - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Field: // h @@ -56,7 +56,7 @@ type Image struct { // Height of the image in pixels. // Recommended for embedded asset responses. // Required for assetsurl/dcourl responses if multiple assets of same type submitted. - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Field: // ext diff --git a/openrtb2/audio.go b/openrtb2/audio.go index 31fc957..9b2ac5a 100644 --- a/openrtb2/audio.go +++ b/openrtb2/audio.go @@ -63,7 +63,7 @@ type Audio struct { // If multiple ad impressions are offered in the same bid request, // the sequence number will allow for the coordinated delivery // of multiple creatives. - Sequence int `json:"sequence,omitempty"` + Sequence int64 `json:"sequence,omitempty"` // Attribute: // battr @@ -91,7 +91,7 @@ type Audio struct { // integer // Description: // Minimum bit rate in Kbps. - MinBitrate int `json:"minbitrate,omitempty"` + MinBitrate int64 `json:"minbitrate,omitempty"` // Attribute: // maxbitrate @@ -99,7 +99,7 @@ type Audio struct { // integer // Description: // Maximum bit rate in Kbps. - MaxBitrate int `json:"maxbitrate,omitempty"` + MaxBitrate int64 `json:"maxbitrate,omitempty"` // Attribute: // delivery @@ -147,7 +147,7 @@ type Audio struct { // The maximum number of ads that can be played in an ad pod. // OpenRTB API Specification Version 2.5 IAB Technology Lab // www.iab.com/openrtb Page 18 - MaxSeq int `json:"maxseq,omitempty"` + MaxSeq int64 `json:"maxseq,omitempty"` // Attribute: // feed diff --git a/openrtb2/banner.go b/openrtb2/banner.go index dbb1281..23fc078 100644 --- a/openrtb2/banner.go +++ b/openrtb2/banner.go @@ -30,7 +30,7 @@ type Banner struct { // Description: // Exact width in device independent pixels (DIPS); // recommended if no format objects are specified. - W *int `json:"w,omitempty"` + W *int64 `json:"w,omitempty"` // Attribute: // h @@ -39,7 +39,7 @@ type Banner struct { // Description: // Exact height in device independent pixels (DIPS); // recommended if no format objects are specified. - H *int `json:"h,omitempty"` + H *int64 `json:"h,omitempty"` // Attribute: // wmax @@ -48,7 +48,7 @@ type Banner struct { // Description: // NOTE: Deprecated in favor of the format array. // Maximum width in device independent pixels (DIPS). - WMax int `json:"wmax,omitempty"` + WMax int64 `json:"wmax,omitempty"` // Attribute: // hmax @@ -57,7 +57,7 @@ type Banner struct { // Description: // NOTE: Deprecated in favor of the format array. // Maximum height in device independent pixels (DIPS). - HMax int `json:"hmax,omitempty"` + HMax int64 `json:"hmax,omitempty"` // Attribute: // wmin @@ -66,7 +66,7 @@ type Banner struct { // Description: // NOTE: Deprecated in favor of the format array. // Minimum width in device independent pixels (DIPS). - WMin int `json:"wmin,omitempty"` + WMin int64 `json:"wmin,omitempty"` // Attribute: // hmin @@ -75,7 +75,7 @@ type Banner struct { // Description: // NOTE: Deprecated in favor of the format array. // Minimum height in device independent pixels (DIPS). - HMin int `json:"hmin,omitempty"` + HMin int64 `json:"hmin,omitempty"` // Attribute: // btype diff --git a/openrtb2/bid.go b/openrtb2/bid.go index 3a067d9..d4e7b5c 100644 --- a/openrtb2/bid.go +++ b/openrtb2/bid.go @@ -232,7 +232,7 @@ type Bid struct { // integer // Description: // Width of the creative in device independent pixels (DIPS). - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // h @@ -240,7 +240,7 @@ type Bid struct { // integer // Description: // Height of the creative in device independent pixels (DIPS). - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // wratio @@ -249,7 +249,7 @@ type Bid struct { // Description: // Relative width of the creative when expressing size as a ratio. // Required for Flex Ads. - WRatio int `json:"wratio,omitempty"` + WRatio int64 `json:"wratio,omitempty"` // Attribute: // hratio @@ -258,7 +258,7 @@ type Bid struct { // Description: // Relative height of the creative when expressing size as a ratio. // Required for Flex Ads. - HRatio int `json:"hratio,omitempty"` + HRatio int64 `json:"hratio,omitempty"` // Attribute: // exp diff --git a/openrtb2/content.go b/openrtb2/content.go index b936be1..7e59c71 100644 --- a/openrtb2/content.go +++ b/openrtb2/content.go @@ -24,7 +24,7 @@ type Content struct { // integer // Description: // Episode number. - Episode int `json:"episode,omitempty"` + Episode int64 `json:"episode,omitempty"` // Attribute: // title diff --git a/openrtb2/device.go b/openrtb2/device.go index a8a6c7b..a356976 100644 --- a/openrtb2/device.go +++ b/openrtb2/device.go @@ -123,7 +123,7 @@ type Device struct { // integer // Description: // Physical height of the screen in pixels. - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // w @@ -131,7 +131,7 @@ type Device struct { // integer // Description: // Physical width of the screen in pixels. - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // ppi @@ -139,7 +139,7 @@ type Device struct { // integer // Description: // Screen size as pixels per linear inch. - PPI int `json:"ppi,omitempty"` + PPI int64 `json:"ppi,omitempty"` // Attribute: // pxratio diff --git a/openrtb2/format.go b/openrtb2/format.go index ab0acbf..eb97101 100644 --- a/openrtb2/format.go +++ b/openrtb2/format.go @@ -15,7 +15,7 @@ type Format struct { // integer // Description: // Width in device independent pixels (DIPS). - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // h @@ -23,7 +23,7 @@ type Format struct { // integer // Description: // Height in device independent pixels (DIPS). - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // wratio @@ -31,7 +31,7 @@ type Format struct { // integer // Description: // Relative width when expressing size as a ratio - WRatio int `json:"wratio,omitempty"` + WRatio int64 `json:"wratio,omitempty"` // Attribute: // hratio @@ -39,7 +39,7 @@ type Format struct { // Integer // Description: // Relative height when expressing size as a ratio. - HRatio int `json:"hratio,omitempty"` + HRatio int64 `json:"hratio,omitempty"` // Attribute: // wmin @@ -48,7 +48,7 @@ type Format struct { // Description: // The minimum width in device independent pixels (DIPS) at // which the ad will be displayed the size is expressed as a ratio. - WMin int `json:"wmin,omitempty"` + WMin int64 `json:"wmin,omitempty"` // Attribute: // ext diff --git a/openrtb2/geo.go b/openrtb2/geo.go index ed3cc37..0417f9d 100644 --- a/openrtb2/geo.go +++ b/openrtb2/geo.go @@ -48,7 +48,7 @@ type Geo struct { // services (i.e., type = 1). Note that this is the accuracy as // reported from the device. Consult OS specific documentation // (e.g., Android, iOS) for exact interpretation. - Accuracy int `json:"accuracy,omitempty"` + Accuracy int64 `json:"accuracy,omitempty"` // Attribute: // lastfix diff --git a/openrtb2/ptr.go b/openrtb2/ptr.go index 738d538..2c82714 100644 --- a/openrtb2/ptr.go +++ b/openrtb2/ptr.go @@ -6,6 +6,6 @@ func Int8Ptr(n int8) *int8 { } // Uint64Ptr returns pointer to passed argument. -func Uint64Ptr(n int) *int { +func Uint64Ptr(n int) *int64 { return &n } diff --git a/openrtb2/video.go b/openrtb2/video.go index b90c058..19702e0 100644 --- a/openrtb2/video.go +++ b/openrtb2/video.go @@ -66,7 +66,7 @@ type Video struct { // integer; recommended // Description: // Width of the video player in device independent pixels (DIPS). - W int `json:"w,omitempty"` + W int64 `json:"w,omitempty"` // Attribute: // h @@ -74,7 +74,7 @@ type Video struct { // integer; recommended // Description: // Height of the video player in device independent pixels (DIPS). - H int `json:"h,omitempty"` + H int64 `json:"h,omitempty"` // Attribute: // startdelay @@ -169,7 +169,7 @@ type Video struct { // integer // Description: // Minimum bit rate in Kbps. - MinBitRate int `json:"minbitrate,omitempty"` + MinBitRate int64 `json:"minbitrate,omitempty"` // Attribute: // maxbitrate @@ -177,7 +177,7 @@ type Video struct { // integer // Description: // Maximum bit rate in Kbps. - MaxBitRate int `json:"maxbitrate,omitempty"` + MaxBitRate int64 `json:"maxbitrate,omitempty"` // Attribute: // boxingallowed diff --git a/openrtb3/item.go b/openrtb3/item.go index 6d5793a..fd106ba 100644 --- a/openrtb3/item.go +++ b/openrtb3/item.go @@ -20,7 +20,7 @@ type Item struct { // integer; default 1 // Definition: // The number of instances (i.e., “quantity”) of this item being offered (e.g., multiple identical impressions in a digital out-of-home scenario). - Qty int `json:"qty,omitempty"` + Qty int64 `json:"qty,omitempty"` // Attribute: // seq @@ -28,7 +28,7 @@ type Item struct { // integer // Definition: // If multiple items are offered in the same bid request, the sequence number allows for the coordinated delivery. - Seq int `json:"seq,omitempty"` + Seq int64 `json:"seq,omitempty"` // Attribute: // flr From 3b335c8434a97dd2913dfb71a8a22e73d9be2fdc Mon Sep 17 00:00:00 2001 From: Max Cherry Date: Sun, 30 Dec 2018 12:45:55 +0200 Subject: [PATCH 5/7] types: integral types hints in README --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 97a39ce..329cacf 100644 --- a/README.md +++ b/README.md @@ -48,14 +48,13 @@ Master always contains latest code, so better use some package manager to vendor - Key types should be chosen according to OpenRTB specification (attribute types) - Numeric types: - `int8` - short enums (with values <= 127), boolean-like attributes (like `BidRequest.test`) - - `int64` - time, duration, length, unbound enums (like `BidRequest.at` - exchange-specific auctions types are > 500) - - `uint64` - width, height, bitrate etc. (unbound positive numbers) + - `int64` - every other integral type - `float64` - coordinates, prices etc. - Enums: - all enums, described in section 5, must be typed with section name singularized (e.g., "5.2 Banner Ad Types" -> `type BannerAdType int8`) - all typed enums must have constants for each element, prefixed with type name (e.g., "5.2 Banner Ad Types - XHTML Text Ad (usually mobile)" -> `const BannerAdTypeXHTMLTextAd BannerAdType = 1`) - never use `iota` for enum constants - - section "5.1 Content Categories" should remain untyped and have no constants + - OpenRTB (2.x) section "5.1 Content Categories" should remain untyped and have no constants ## Pointers/omitempty Pointer | Omitempty | When to use | Example From aad0abdd75f2ffe0111311228eb1bfb091f723a0 Mon Sep 17 00:00:00 2001 From: Max Cherry Date: Sun, 30 Dec 2018 12:47:22 +0200 Subject: [PATCH 6/7] types: fix openrtb2 ptr helpers --- openrtb2/ptr.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openrtb2/ptr.go b/openrtb2/ptr.go index 2c82714..79b82c6 100644 --- a/openrtb2/ptr.go +++ b/openrtb2/ptr.go @@ -5,7 +5,7 @@ func Int8Ptr(n int8) *int8 { return &n } -// Uint64Ptr returns pointer to passed argument. -func Uint64Ptr(n int) *int64 { +// Int64Ptr returns pointer to passed argument. +func Int64Ptr(n int64) *int64 { return &n } From c4c0e4b2cc8cd8477deb9107929ca76f528f8980 Mon Sep 17 00:00:00 2001 From: Max Cherry Date: Sun, 30 Dec 2018 12:51:05 +0200 Subject: [PATCH 7/7] types: fix comments after mass-replace --- adcom1/geo.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/adcom1/geo.go b/adcom1/geo.go index 088fee6..bc6b79e 100644 --- a/adcom1/geo.go +++ b/adcom1/geo.go @@ -113,8 +113,6 @@ type Geo struct { // integer // Definition: // Local time as the number +/- of minutes from UTC. - // Dev note: - // This field is kept as `int` to follow type choice for timezone offset in std. `time` package. UTCOffset int64 `json:"utcoffset,omitempty"` // Attribute: