go-rtb

GoDoc

Common OpenRTB v2.3 Object types for Go programming language

Warning! Currently, this package is quite unstable (types and names may change). Also, even after v1.0 this repo will contain only recent version (v1+). So, if you need to use this code in production, take a look on godep.

Progress

  • 3.2 Object Specifications
    • 3.2.1 Object: BidRequest
    • 3.2.2 Object: Imp
    • 3.2.3 Object: Banner
    • 3.2.4 Object: Video
    • 3.2.5 Object: Native
    • 3.2.6 Object: Site
    • 3.2.7 Object: App
    • 3.2.8 Object: Publisher
    • 3.2.9 Object: Content
    • 3.2.10 Object: Producer
    • 3.2.11 Object: Device
    • 3.2.12 Object: Geo
    • 3.2.13 Object: User
    • 3.2.14 Object: Data
    • 3.2.15 Object: Segment
    • 3.2.16 Object: Regs
    • 3.2.17 Object: Pmp
    • 3.2.18 Object: Deal
  • 4.2 Object Specifications
    • 4.2.1 Object: BidResponse
    • 4.2.2 Object: SeatBid
    • 4.2.3 Object: Bid
  • Code quality/review
    • Review struct key types, which refer to section "5. Enumerated Lists Specification"
    • Check types for struct keys (see Guidelines - Types)
    • Use struct pointers for optional keys (e.g., App.Content)
    • Add json directive "omitempty" for optional keys

Guidelines

Naming convention

  • UpperCamelCase
  • Capitalized abbreviations (e.g., AT, COPPA, PMP etc.)
  • Capitalized ID keys

Types

  • Key types should be chosen according to OpenRTB specification (attribute types)
  • Numeric types:
    • architecture-independent, e.g., int32 instead of int
    • signed integral types should be used only when absolutely needed (value may contain negative numbers), unsigned integral types are preferred
    • enumerations should be represented with minimal integral types, e.g., uint8 or int8 for enumerations with <= 256 variants
    • for floating-point attributes only float64 type should be used

Documentation

  • Godoc: documenting Go code
  • Each entity (type or struct key) should be documented
  • Comments for entities should be copy-pasted "as-is" from OpenRTB specification

Code organization

  • Each RTB type should be kept in its own file, named after type
  • File names are in underscore_case, e.g., type BidRequest should be declared in bid_request.go
  • go fmt your code
S
Description
Go (Golang) OpenRTB 2.x, 3.0 / AdCOM 1.0 / Native 1.2 types/enums
Readme 913 KiB
Languages
Go 100%