Documentation
¶
Index ¶
- Constants
- Variables
- func FormatFromModel(format *models.Format) *types.Format
- type Account
- type AccountBalanceState
- type AccountTarget
- type AdFileAsset
- type AdFileAssetThumb
- type AdFileAssets
- type AdFlag
- type Application
- type CampaignFlagType
- type GeoBid
- type GeoBidSlice
- type NamedErrorWrapper
- type Project
- type RTBRequestType
- type RTBSource
- type RTBSourceFlags
- type State
- type TrafficRouter
- type User
Constants ¶
const ( RTBRequestTypeUndefined = types.RTBRequestTypeUndefined RTBRequestTypeJSON = types.RTBRequestTypeJSON RTBRequestTypeXML = types.RTBRequestTypeXML RTBRequestTypeProtoBUFF = types.RTBRequestTypeProtoBUFF RTBRequestTypePOSTFormEncoded = types.RTBRequestTypePOSTFormEncoded RTBRequestTypePLAINTEXT = types.RTBRequestTypePLAINTEXT )
Request types
const (
UserFlagCanHaveNegativeBalance = 1 << iota
)
User set of flags
Variables ¶
var ( FormatVideoFieldSet = []string{ types.FormatFieldTitle, types.FormatFieldBrandname, types.FormatFieldURL, types.FormatFieldStartDisplay, } FormatNativeFieldSet = []string{ types.FormatFieldTitle, types.FormatFieldDescription, types.FormatFieldBrandname, types.FormatFieldURL, types.FormatFieldPhone, } )
Formats field set
Functions ¶
Types ¶
type Account ¶
type Account struct {
IDval uint64 // Authoincrement key
MaxDaily billing.Money
CurrentState AccountBalanceState
// For example:
// Displayed ads for 100$
// Account revenue share 60%
// In such case the ad network have 40$
// The publisher have 60$
RevenueShare float64 // % 1.0 -> 100%, 0.655 -> 65.5%
}
Account model
func (*Account) CommissionShareFactor ¶
CommissionShareFactor which system get from publisher 0..1
func (*Account) DailyBudget ¶
DailyBudget of the account
type AccountBalanceState ¶
type AccountTarget ¶
type AccountTarget struct {
Acc *Account
}
AccountTarget wrapper for replace of epsent target object
func (AccountTarget) AccountID ¶
func (c AccountTarget) AccountID() uint64
AccountID of current target
func (AccountTarget) CommissionShareFactor ¶
func (c AccountTarget) CommissionShareFactor() float64
CommissionShareFactor of current target
type AdFileAsset ¶
type AdFileAsset struct {
ID uint64 `json:"id,omitempty"`
Name string `json:"name,omitempty"` // Name of the asset, like "main", "banner", "icon", etc.
URL string `json:"url,omitempty"` // In case of HTML5, hare must be the path to directory on CDN
Type types.AdFileAssetType `json:"type,omitempty"`
ContentType string `json:"content_type,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Thumbs []AdFileAssetThumb
}
AdFileAsset information
func (*AdFileAsset) ThumbBy ¶
func (f *AdFileAsset) ThumbBy(w, h, wmin, hmin int) (th *AdFileAssetThumb)
ThumbBy size borders and specific type
type AdFileAssetThumb ¶
type AdFileAssetThumb struct {
URL string `json:"url"`
Width int `json:"w"`
Height int `json:"h"`
Type types.AdFileAssetType `json:"type,omitempty"`
}
AdFileAssetThumb of the file
func (AdFileAssetThumb) IsSuits ¶
func (th AdFileAssetThumb) IsSuits(w, h, wmin, hmin int) bool
IsSuits thumb by size
type AdFileAssets ¶
type AdFileAssets []*AdFileAsset
AdFileAssets contains the list of file assets
func (AdFileAssets) Asset ¶
func (assets AdFileAssets) Asset(name string) *AdFileAsset
Asset by name
func (AdFileAssets) AssetBanner ¶
func (assets AdFileAssets) AssetBanner(w, h int) *AdFileAsset
AssetBanner by fixed size
type AdFlag ¶
type AdFlag uint8
AdFlag option state type
const ( AdFlagIsPremium AdFlag = 0x01 AdFlagActive AdFlag = 0x02 AdFlagInsecure AdFlag = 0x04 AdFlagAsPopover AdFlag = 0x08 )
Ad flag option types
func (AdFlag) IsInsecure ¶
type Application ¶
type Application struct {
ID uint64 // Authoincrement key
Account *Account // Account which application belongs to
AccountID uint64 //
URI string // Unical application identificator
Type types.ApplicationType `gorm:"type:ApplicationType" json:"type"`
Platform types.PlatformType `gorm:"type:PlatformType" json:"platform"`
Premium bool `json:"premium"`
Categories []uint
}
Application model
func ApplicationFromModel ¶
func ApplicationFromModel(app *models.Application) Application
ApplicationFromModel convert database model to specified model
func (*Application) CommissionShareFactor ¶
func (a *Application) CommissionShareFactor() float64
CommissionShareFactor which system get from publisher
func (*Application) ObjectKey ¶
func (a *Application) ObjectKey() string
ObjectKey of the application
type CampaignFlagType ¶
type CampaignFlagType uint8
CampaignFlagType type of the flags
const ( CampaignFlagActive CampaignFlagType = 1 << iota // 0x01 CampaignFlagDeleted // CampaignFlagPrivate // Private campaigns not avalable for publick usage CampaignFlagPremium CampaignFlagHasWeighedAds )
Flags set
func (CampaignFlagType) HasWeighedAds ¶
func (f CampaignFlagType) HasWeighedAds() bool
func (CampaignFlagType) IsActive ¶
func (f CampaignFlagType) IsActive() bool
func (CampaignFlagType) IsDeleted ¶
func (f CampaignFlagType) IsDeleted() bool
func (CampaignFlagType) IsPremium ¶
func (f CampaignFlagType) IsPremium() bool
func (CampaignFlagType) IsPrivate ¶
func (f CampaignFlagType) IsPrivate() bool
type GeoBidSlice ¶
type GeoBidSlice []GeoBid
GeoBidSlice type
func (GeoBidSlice) IndexOf ¶
func (a GeoBidSlice) IndexOf(code [2]byte) int
IndexOf by country code (only for ordered)
func (GeoBidSlice) Len ¶
func (a GeoBidSlice) Len() int
func (GeoBidSlice) Less ¶
func (a GeoBidSlice) Less(i, j int) bool
func (GeoBidSlice) Swap ¶
func (a GeoBidSlice) Swap(i, j int)
type NamedErrorWrapper ¶
type NamedErrorWrapper struct {
// contains filtered or unexported fields
}
NamedErrorWrapper type
func NewNamedErrorWrapper ¶
func NewNamedErrorWrapper(name string, err error) NamedErrorWrapper
NewNamedErrorWrapper returns new error object
func (NamedErrorWrapper) Error ¶
func (err NamedErrorWrapper) Error() string
func (NamedErrorWrapper) GetName ¶
func (err NamedErrorWrapper) GetName() string
GetName of the error
func (NamedErrorWrapper) OriginalError ¶
func (err NamedErrorWrapper) OriginalError() error
OriginalError of the wrapper
type Project ¶
type Project struct {
ID uint64
UserID uint64
Balance billing.Money
MaxDaily billing.Money
Spent billing.Money
}
Project model
func (*Project) CommissionShareFactor ¶
CommissionShareFactor which system get from publisher 0..1
type RTBRequestType ¶
type RTBRequestType = types.RTBRequestType
RTBRequestType contains type of representation of request information
type RTBSource ¶
type RTBSource struct {
ID uint64
Account *Account
Protocol string // rtb as default
URL string // RTB client request URL
Method string // HTTP method GET, POST, ect; Default POST
RequestType RTBRequestType // 1 - json, 2 - xml, 3 - ProtoBUFF, 4 - MultipleFormaData, 5 - PLAINTEXT
Headers gosql.NullableJSON[map[string]string]
Options RTBSourceFlags
Filter types.BaseFilter
AuctionType types.AuctionType // default: 0 – first price type, 1 – second price type
RPS int // 0 – unlimit
Timeout int // In milliseconds
Accuracy float64 // Price accuracy for auction in percentages
PriceCorrectionReduce float64 // % 100, 80%, 65.5% - 0 .. 1
MinimalWeight float64
// Price limits
MinBid billing.Money // Minimal bid value
MaxBid billing.Money // Maximal bid value
// TODO
Budget billing.Money // Budget for this source
DailyBudget billing.Money // Daily budget for this source
Config gosql.NullableJSON[any]
}
RTBSource describe the source of external DSP platform or similar exchange protocol. All that sources have similar options and very common prefilter configurations
func RTBSourceFromModel ¶
RTBSourceFromModel convert database model to specified model
func (*RTBSource) PriceCorrectionReduceFactor ¶
PriceCorrectionReduceFactor which is a potential Returns percent from 0 to 1 for reducing of the value If there is 10% of price correction, it means that 10% of the final price must be ignored
func (*RTBSource) TestFormat ¶
TestFormat available in filter
type RTBSourceFlags ¶
type RTBSourceFlags = models.RTBSourceFlags
type TrafficRouter ¶
type TrafficRouter struct {
ID uint64
RTBSourceIDs []uint64
// Percentage of traffic to be routed
Percent float32
Filter types.BaseFilter
}
TrafficRouter represents a traffic router in the system.
func (*TrafficRouter) ObjectKey ¶
func (d *TrafficRouter) ObjectKey() uint64
ObjectKey of the router
func (*TrafficRouter) Test ¶
func (d *TrafficRouter) Test(target types.TargetPointer) bool
Test checks if the target matches the filter criteria.