mirror of
https://github.com/prebid/openrtb.git
synced 2026-06-14 22:16:41 +03:00
9640e82bf5972553bdc22efe3ad5795a2abbbc91
openrtb
OpenRTB v2.3 types for Go programming language (golang)
Warning! This package is quite stable (changes very infrequently even being v0.x.x), but using glide is highly recommended to vendor specific commit hash.
Using
go get -u "http://gopkg.in/mxmCherry/openrtb.v0"
import "http://gopkg.in/mxmCherry/openrtb.v0"
Goals
Provide base for OpenRTB-related projects, focusing on:
- Extensive documentation
- Strict specification (using unsigned numeric types for values, that are not meant to be signed; don't overuse pointers to avoid nil dereferencing etc.)
- Efficient memory usage (using numeric types large enough just to hold intended values etc.)
Guidelines
Naming convention
- UpperCamelCase
- Capitalized abbreviations (e.g., AT, COPPA, PMP etc.)
- Capitalized ID keys
Types
- Key types should be chosen according to OpenRTB v2.3 specification (attribute types)
- Numeric types:
- architecture-independent, e.g.,
int32instead ofint - 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.,
uint8orint8for enumerations with <= 256 variants - for floating-point attributes only
float64type should be used
- architecture-independent, e.g.,
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 BidRequestshould be declared inbid_request.go - go fmt your code
Languages
Go
100%