mirror of
https://github.com/prebid/openrtb.git
synced 2026-06-15 14:36:36 +03:00
5bbe78d9ffee369d7f2f5383d0ad71e4df5cdceb
openrtb

OpenRTB v2.5 types for Go programming language (Golang)
Using
go get -u "github.com/mxmCherry/openrtb"
import "github.com/mxmCherry/openrtb"
This repo follows semver - see releases. Master always contains latest code, so better use some package manager to vendor specific version.
Guidelines
Naming convention
- UpperCamelCase
- Capitalized abbreviations (e.g.,
AT,COPPA,PMPetc.) - Capitalized
IDkeys
Types
- Key types should be chosen according to OpenRTB specification (attribute types)
- Numeric types:
int64- time, duration, unbound enums (likeBidRequest.at- exchange-specific auctions types are > 500)int8- short enums (with values <= 127), boolean-like attributes (likeBidRequest.test)uint64- width, height, bitrate etc. (unbound positive numbers)float64- coordinates, prices etc.
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 (including line-breaks - think less)
Code organization
- Each RTB type should be kept in its own file, named after type
- File names are in underscore_case, e.g.,
type BidRequestshould be declared inbid_request.go - go fmt your code
TODO
- Review all integral types, probably, switch everything to signed ones or just to
int? - Consider switching back to
encoding/json.RawMessage, as Go 1.8 fixed serialisation for non-ptr (probably, when Go 1.9 or even 1.10 is out) - Review enum types (typed enum attributes + constants)
Languages
Go
100%