models

package
v0.0.0-...-9b50b6c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 11

Documentation

Index

Constants

View Source
const (
	DeviceTypeUnknown   = udetect.DeviceTypeUnknown
	DeviceTypeMobile    = udetect.DeviceTypeMobile    // Mobile/Tablet
	DeviceTypePC        = udetect.DeviceTypePC        // Desktop
	DeviceTypeTV        = udetect.DeviceTypeTV        // TV
	DeviceTypePhone     = udetect.DeviceTypePhone     // SmartPhone, SmallScreen
	DeviceTypeTablet    = udetect.DeviceTypeTablet    // Tablet
	DeviceTypeConnected = udetect.DeviceTypeConnected // Console, EReader, Watch
	DeviceTypeSetTopBox = udetect.DeviceTypeSetTopBox // MediaHub
	DeviceTypeWatch     = udetect.DeviceTypeWatch     // SmartWatch
	DeviceTypeGlasses   = udetect.DeviceTypeGlasses   // Glasses
	DeviceTypeOOH       = udetect.DeviceTypeOOH       // Out of Home - Billboards, Kiosks, etc.
)

Device set of types

View Source
const (
	FormatTypeDirect = `direct`
	FormatTypeVideo  = `video`
	FormatTypeProxy  = `proxy`
	FormatTypeNative = `native`
	FormatTypeBanner = `banner`
)

Format types... TODO: switch format-type check on type

View Source
const (
	FormatFieldStringType  = types.FormatFieldStringType
	FormatFieldIntType     = types.FormatFieldIntType
	FormatFieldFloatType   = types.FormatFieldFloatType
	FormatFieldBoolType    = types.FormatFieldBoolType
	FormatFieldPhoneType   = types.FormatFieldPhoneType
	FormatFieldDefaultType = types.FormatFieldDefaultType
)

Format Field types

View Source
const (
	FormatFieldTitle        = types.FormatFieldTitle
	FormatFieldDescription  = types.FormatFieldDescription
	FormatFieldBrandname    = types.FormatFieldBrandname
	FormatFieldPhone        = types.FormatFieldPhone
	FormatFieldURL          = types.FormatFieldURL
	FormatFieldStartDisplay = types.FormatFieldStartDisplay
	FormatFieldContent      = types.FormatFieldContent
	FormatFieldRating       = types.FormatFieldRating
	FormatFieldLikes        = types.FormatFieldLikes
	FormatFieldAddress      = types.FormatFieldAddress
)

Format field defaults

View Source
const (
	PricingModelUndefined = types.PricingModelUndefined
	PricingModelCPM       = types.PricingModelCPM
	PricingModelCPC       = types.PricingModelCPC
	PricingModelCPA       = types.PricingModelCPA
)

PricingModel consts

View Source
const (
	RTBPricePerMille = iota
	RTBPricePerOne
)

RTB price type

Variables

View Source
var DeviceTypeList = []*DeviceType{
	{
		ID:          uint64(DeviceTypeUnknown),
		Codename:    "unknown",
		Name:        "Unknown",
		Description: "Unknown device type",
		Active:      types.StatusActive,
	},
	{
		ID:          uint64(DeviceTypeMobile),
		Codename:    "mobile",
		Name:        "Mobile",
		Description: "Mobile device",
		Active:      types.StatusActive,
	},
	{
		ID:          uint64(DeviceTypePC),
		Codename:    "pc",
		Name:        "PC",
		Description: "Personal Computer",
		Active:      types.StatusActive,
	},
	{
		ID:          uint64(DeviceTypeTV),
		Codename:    "tv",
		Name:        "TV",
		Description: "TV device",
		Active:      types.StatusActive,
	},
	{
		ID:          uint64(DeviceTypePhone),
		Codename:    "phone",
		Name:        "Phone",
		Description: "Phone device",
		Active:      types.StatusActive,
	},
	{
		ID:          uint64(DeviceTypeTablet),
		Codename:    "tablet",
		Name:        "Tablet",
		Description: "Tablet device",
		Active:      types.StatusActive,
	},
	{
		ID:          uint64(DeviceTypeConnected),
		Codename:    "connected",
		Name:        "Connected",
		Description: "Connected device (Console, EReader)",
		Active:      types.StatusActive,
	},
	{
		ID:          uint64(DeviceTypeSetTopBox),
		Codename:    "settopbox",
		Name:        "SetTopBox",
		Description: "SetTopBox device",
		Active:      types.StatusActive,
	},
	{
		ID:          uint64(DeviceTypeWatch),
		Codename:    "watch",
		Name:        "Watch",
		Description: "Watch device",
		Active:      types.StatusActive,
	},
	{
		ID:          uint64(DeviceTypeGlasses),
		Codename:    "glasses",
		Name:        "Glasses",
		Description: "Glasses device",
		Active:      types.StatusActive,
	},
	{
		ID:          uint64(DeviceTypeOOH),
		Codename:    "ooh",
		Name:        "OOH",
		Description: "Out of Home device",
		Active:      types.StatusActive,
	},
}

DeviceTypeList is a list of DeviceType

Functions

This section is empty.

Types

type Application

type Application struct {
	ID uint64 `json:"id" gorm:"primaryKey"` // Authoincrement key

	Title       string `json:"title"`
	Description string `json:"description"`

	AccountID uint64 `json:"account_id"`
	CreatorID uint64 `json:"creator_id"`

	// Unical application identificator like:
	//   - site domain -> domain.com
	//   - mobile/desktop application bundle -> com.application.game
	URI      string                `json:"uri"`
	Type     types.ApplicationType `gorm:"type:ApplicationType" json:"type"`
	Platform types.PlatformType    `gorm:"type:PlatformType" json:"platform"`
	Premium  bool                  `json:"premium"`

	// Status of the application
	Status types.ApproveStatus `gorm:"type:ApproveStatus" json:"status"`

	// Is Active application
	Active types.ActiveStatus `gorm:"type:ActiveStatus" json:"active"`

	// Is private campaign type
	Private types.PrivateStatus `gorm:"type:PrivateStatus;not null" json:"private"`

	Categories gosql.NullableNumberArray[uint] `gorm:"type:BIGINT[]" json:"categories,omitempty"`

	// RevenueShare it's amount of percent of the raw incode which will be shared with the publisher company
	// For example:
	//   Displayed ads for 100$
	//   Company revenue share 60%
	//   In such case the ad network have 40$
	//   The publisher have 60$
	// Optional
	RevenueShare float64 `json:"revenue_share,omitempty"` // % 1.0 -> 100%, 0.655 -> 65.5%

	// Advertisement sources
	AllowedSources    gosql.NullableOrderedNumberArray[int64] `gorm:"type:BIGINT[]" json:"allowed_sources,omitempty"`
	DisallowedSources gosql.NullableOrderedNumberArray[int64] `gorm:"type:BIGINT[]" json:"disallowed_sources,omitempty"`

	// Time marks
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"`
}

Application model describes site or mobile/desktop application

func (*Application) RBACResourceName

func (app *Application) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*Application) TableName

func (app *Application) TableName() string

TableName in database

type Browser

type Browser struct {
	ID uint64 `json:"id"`

	Name        string        `json:"name"`
	Version     types.Version `json:"version,omitempty"`
	Description string        `json:"description,omitempty"`

	YearRelease    int `json:"year_release,omitempty"`
	YearEndSupport int `json:"year_end_support,omitempty"`

	// Match expressions
	MatchNameExp       string `json:"match_name_exp,omitempty"`
	MatchUserAgentExp  string `json:"match_ua_exp,omitempty"`
	MatchVersionMinExp string `json:"match_ver_min_exp,omitempty"`
	MatchVersionMaxExp string `json:"match_ver_max_exp,omitempty"`

	Active types.ActiveStatus `gorm:"type:ActiveStatus" json:"active,omitempty"`

	ParentID sql.Null[uint64] `json:"parent_id,omitempty"`
	Parent   *Browser         `json:"parent,omitempty" gorm:"foreignKey:ParentID;references:ID"`
	Versions []*Browser       `json:"versions,omitempty" gorm:"foreignKey:ParentID;references:ID"`

	// Time marks
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"`
}

Browser model description

func (*Browser) RBACResourceName

func (m *Browser) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*Browser) TableName

func (m *Browser) TableName() string

TableName in database

type Category

type Category struct {
	ID          uint64 `json:"id" gorm:"primaryKey"`
	Name        string `json:"name"`
	Description string `json:"description"`

	IABCode string `json:"iab_code"` // IAB category code of OpenRTB

	ParentID  sql.Null[uint64] `json:"parent_id" gorm:"column:parent_id"`
	Parent    *Category        `json:"parent,omitempty" gorm:"foreignKey:parent_id;references:ID"`
	Childrens []*Category      `json:"childrens,omitempty" gorm:"foreignKey:parent_id;references:ID"`
	Position  uint64           `json:"position"`

	// Is Active advertisement
	Active types.ActiveStatus `gorm:"type:ActiveStatus" json:"active"`

	// Time marks
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"`
}

Category model description

func (*Category) RBACResourceName

func (c *Category) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*Category) TableName

func (c *Category) TableName() string

TableName in database

type DeviceMaker

type DeviceMaker struct {
	ID          uint64 `json:"id" gorm:"primaryKey"`
	Codename    string `json:"codename" gorm:"unique"`
	Name        string `json:"name"`
	Description string `json:"description"`

	// "github.com/IGLOU-EU/go-wildcard/v2" package sintax
	MatchExp string `json:"match_exp,omitempty"`

	Active types.ActiveStatus `gorm:"type:ActiveStatus" json:"active,omitempty"`

	Models []*DeviceModel `json:"models,omitempty" gorm:"foreignKey:MakerCodename;references:Codename"`

	// Time marks
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"`
}

func (*DeviceMaker) RBACResourceName

func (m *DeviceMaker) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*DeviceMaker) TableName

func (m *DeviceMaker) TableName() string

TableName in database

type DeviceModel

type DeviceModel struct {
	ID          uint64 `json:"id" gorm:"primaryKey"`
	Codename    string `json:"codename" gorm:"unique"`
	Name        string `json:"name"`
	Description string `json:"description"`

	ParentID uint64       `json:"parent_id,omitempty"`
	Parent   *DeviceModel `json:"parent,omitempty" gorm:"foreignKey:ParentID;references:ID"`

	YearRelease int `json:"year_release,omitempty"`

	Active types.ActiveStatus `gorm:"type:ActiveStatus" json:"active,omitempty"`

	MatchExp string `json:"match_exp,omitempty"`

	// Link to device maker
	MakerCodename string       `json:"maker_codename,omitempty"`
	Maker         *DeviceMaker `json:"maker,omitempty" gorm:"foreignKey:MakerCodename;references:Codename"`

	// Device type
	TypeCodename string      `json:"type_codename,omitempty"`
	Type         *DeviceType `json:"type,omitempty" gorm:"foreignKey:TypeCodename;references:Codename"`

	// Versions of the model
	Versions []*DeviceModel `json:"versions,omitempty" gorm:"foreignKey:ParentID;references:ID"`

	// Time marks
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"`
}

func (*DeviceModel) RBACResourceName

func (m *DeviceModel) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*DeviceModel) TableName

func (m *DeviceModel) TableName() string

TableName in database

type DeviceType

type DeviceType struct {
	ID          uint64 `json:"id" gorm:"primaryKey"`
	Codename    string `json:"codename" gorm:"unique"`
	Name        string `json:"name"`
	Description string `json:"description"`

	Active types.ActiveStatus `gorm:"type:ActiveStatus" json:"active,omitempty"`

	// Time marks
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"`
}

func (*DeviceType) RBACResourceName

func (m *DeviceType) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*DeviceType) TableName

func (m *DeviceType) TableName() string

TableName in database

type Format

type Format struct {
	ID       uint64 `json:"id" gorm:"primaryKey"`
	Codename string `json:"codename"`
	Type     string `json:"type"`

	Title       string `json:"title"`
	Description string `json:"description"`

	Active types.ActiveStatus `gorm:"type:ActiveStatus" json:"active,omitempty"`

	Width     int `json:"width,omitempty"`
	Height    int `json:"height,omitempty"`
	MinWidth  int `json:"min_width,omitempty"`
	MinHeight int `json:"min_height,omitempty"`

	Config gosql.NullableJSON[types.FormatConfig] `gorm:"type:JSONB" json:"config,omitempty"`

	// Time marks
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"`
}

Format model description

func (Format) IsBanner

func (f Format) IsBanner() bool

IsBanner type of format

func (Format) IsDirect

func (f Format) IsDirect() bool

IsDirect type (popunder or proxy or etc.)

func (*Format) IsFixed

func (f *Format) IsFixed() bool

IsFixed format

func (Format) IsNative

func (f Format) IsNative() bool

IsNative type of format

func (Format) IsProxy

func (f Format) IsProxy() bool

IsProxy type of format

func (*Format) IsStretch

func (f *Format) IsStretch() bool

IsStretch format

func (Format) IsVideo

func (f Format) IsVideo() bool

IsVideo type of advertisement

func (*Format) RBACResourceName

func (f *Format) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*Format) TableName

func (f *Format) TableName() string

TableName in database

type FormatFieldType

type FormatFieldType = types.FormatFieldType

FormatFieldType format

type OS

type OS struct {
	ID uint64 `json:"id" gorm:"primaryKey"`

	Name        string        `json:"name"`
	Version     types.Version `json:"version,omitempty"`
	Description string        `json:"description,omitempty"`

	YearRelease    int `json:"year_release,omitempty"`
	YearEndSupport int `json:"year_end_support,omitempty"`

	// Match expressions
	MatchNameExp       string `json:"match_name_exp,omitempty"`
	MatchUserAgentExp  string `json:"match_ua_exp,omitempty"`
	MatchVersionMinExp string `json:"match_ver_min_exp,omitempty"`
	MatchVersionMaxExp string `json:"match_ver_max_exp,omitempty"`

	Active types.ActiveStatus `gorm:"type:ActiveStatus" json:"active,omitempty"`

	ParentID sql.Null[uint64] `json:"parent_id,omitempty"`
	Parent   *OS              `json:"parent,omitempty" gorm:"foreignKey:ParentID;references:ID"`
	Versions []*OS            `json:"versions,omitempty" gorm:"foreignKey:ParentID;references:ID"`

	// Time marks
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"`
}

OS model description

func (*OS) RBACResourceName

func (m *OS) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*OS) TableName

func (m *OS) TableName() string

TableName in database

type PricingModel

type PricingModel = types.PricingModel

PricingModel value

func PricingModelByName

func PricingModelByName(model string) PricingModel

PricingModelByName string

type RTBSource

type RTBSource struct {
	ID        uint64 `json:"id" gorm:"primaryKey"`
	AccountID uint64 `json:"account_id,omitempty"`

	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`

	Status types.ApproveStatus                `gorm:"type:ApproveStatus" json:"status,omitempty"`
	Active types.ActiveStatus                 `gorm:"type:ActiveStatus" json:"active,omitempty"`
	Flags  gosql.NullableJSON[RTBSourceFlags] `gorm:"type:JSONB" json:"flags,omitempty"`

	Protocol      string                                `json:"protocol"`                                // rtb as default
	MinimalWeight float64                               `json:"minimal_weight"`                          //
	URL           string                                `json:"url"`                                     // RTB client request URL
	Method        string                                `json:"method"`                                  // HTTP method GET, POST, ect; Default POST
	RequestType   types.RTBRequestType                  `gorm:"type:RTBRequestType" json:"request_type"` // 1 - json, 2 - xml, 3 - ProtoBUFF, 4 - PLAINTEXT
	Headers       gosql.NullableJSON[map[string]string] `gorm:"type:JSONB" json:"headers,omitempty"`     //
	RPS           int                                   `json:"rps"`                                     // 0 – unlimit
	Timeout       int                                   `json:"timeout"`                                 // In milliseconds

	// Money configs
	Accuracy              float64           `json:"accuracy,omitempty"`                             // Price accuracy for auction in percentages
	PriceCorrectionReduce float64           `json:"price_correction_reduce,omitempty"`              // % 100_00, 10000 -> 100%, 6550 -> 65.5%
	AuctionType           types.AuctionType `gorm:"type:AuctionType" json:"auction_type,omitempty"` // default: 0 – first price type, 1 – second price type

	// Price limits
	MinBid float64 `json:"min_bid,omitempty"` // Minimal bid value
	MaxBid float64 `json:"max_bid,omitempty"` // Maximal bid value

	// Targeting filters
	Formats             gosql.NullableStringArray                `gorm:"type:TEXT[]" json:"formats,omitempty"`              // => Filters
	InterstitialFormats gosql.NullableStringArray                `gorm:"type:TEXT[]" json:"interstitial_formats,omitempty"` // => Filters
	DeviceTypes         gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"device_types,omitempty"`       //
	Devices             gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"devices,omitempty"`            //
	OS                  gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"os,omitempty"`                 //
	Browsers            gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"browsers,omitempty"`           //
	Carriers            gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"carriers,omitempty"`           //
	Categories          gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"categories,omitempty"`         //
	Countries           gosql.NullableStringArray                `gorm:"type:TEXT[]" json:"countries,omitempty"`            //
	Languages           gosql.NullableStringArray                `gorm:"type:TEXT[]" json:"languages,omitempty"`            //
	Domains             gosql.NullableStringArray                `gorm:"type:TEXT[]" json:"domains,omitempty"`              //
	Applications        gosql.NullableOrderedNumberArray[uint64] `gorm:"column:apps;type:BIGINT[]" json:"apps,omitempty"`   //
	Zones               gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"zones,omitempty"`              //
	ExternalZones       gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"external_zones,omitempty"`     //
	Secure              int                                      `json:"secure,omitempty"`                                  // 0 - any, 1 - only, 2 - exclude
	AdBlock             int                                      `json:"adblock,omitempty" gorm:"column:adblock"`           // 0 - any, 1 - only, 2 - exclude
	PrivateBrowsing     int                                      `json:"private_browsing,omitempty"`                        // 0 - any, 1 - only, 2 - exclude
	IP                  int                                      `json:"ip,omitempty"`                                      // 0 - any, 1 - IPv4, 2 - IPv6

	Config gosql.NullableJSON[RTBSourceConfig] `gorm:"type:JSONB" json:"config"`

	// Time marks
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

RTBSource for SSP connect

func (*RTBSource) PriceCorrectionReduceFactor

func (c *RTBSource) PriceCorrectionReduceFactor() float64

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) ProtocolCode

func (c *RTBSource) ProtocolCode() string

ProtocolCode name

func (*RTBSource) RBACResourceName

func (c *RTBSource) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*RTBSource) TableName

func (c *RTBSource) TableName() string

TableName in database

type RTBSourceConfig

type RTBSourceConfig struct {
	Rules string `json:"rules,omitempty"`
}

type RTBSourceFlags

type RTBSourceFlags struct {
	Trace        int8 `json:"trace,omitempty"`
	TestMode     int8 `json:"test_mode,omitempty"`
	ErrorsIgnore int8 `json:"errors_ignore,omitempty"`
}

type TrafficRouter

type TrafficRouter struct {
	ID        uint64 `json:"id"`
	AccountID uint64 `json:"account_id"`

	Title   string  `json:"title"`
	Percent float64 `json:"percent"`

	Description string              `json:"description"`
	Status      types.ApproveStatus `gorm:"type:ApproveStatus" json:"status,omitempty"`
	Active      types.ActiveStatus  `json:"active"`

	// Target RTB`s and sources of the Advertisement
	RTBSourceIDs gosql.NumberArray[uint64] `gorm:"type:BIGINT[]" json:"rtb_source_ids"`

	// Targeting filters
	Formats     gosql.NullableStringArray                `gorm:"type:TEXT[]" json:"formats,omitempty"`        // => Filters
	DeviceTypes gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"device_types,omitempty"` //
	Devices     gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"devices,omitempty"`      //
	OS          gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"os,omitempty"`           //
	Browsers    gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"browsers,omitempty"`     //
	Carriers    gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"carriers,omitempty"`     //
	Categories  gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"categories,omitempty"`   //
	Countries   gosql.NullableStringArray                `gorm:"type:TEXT[]" json:"countries,omitempty"`      //
	Languages   gosql.NullableStringArray                `gorm:"type:TEXT[]" json:"languages,omitempty"`      //

	Domains      gosql.NullableStringArray                `gorm:"type:TEXT[]" json:"domains,omitempty"`
	Applications gosql.NullableOrderedNumberArray[uint64] `gorm:"column:apps;type:BIGINT[]" json:"apps,omitempty"`
	Zones        gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"zones,omitempty"`

	Secure          int `json:"secure,omitempty"`                        // 0 - any, 1 - only, 2 - exclude
	AdBlock         int `json:"adblock,omitempty" gorm:"column:adblock"` // 0 - any, 1 - only, 2 - exclude
	PrivateBrowsing int `json:"private_browsing,omitempty"`              // 0 - any, 1 - only, 2 - exclude
	IP              int `json:"ip,omitempty"`

	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

TrafficRouter model represents the traffic router for the traffic distribution between the RTB sources from the Applications and Zones

func (*TrafficRouter) RBACResourceName

func (tr *TrafficRouter) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*TrafficRouter) TableName

func (tr *TrafficRouter) TableName() string

TableName in database

type Zone

type Zone struct {
	ID       uint64 `json:"id"`
	Codename string `json:"codename" gorm:"unique_index"`

	Title       string `json:"title"`
	Description string `json:"description"`

	AccountID uint64 `json:"account_id,omitempty"`

	Type   types.ZoneType      `gorm:"type:ZoneType" json:"type,omitempty"`
	Status types.ApproveStatus `gorm:"type:ApproveStatus" json:"status"`
	Active types.ActiveStatus  `gorm:"type:ActiveStatus" json:"active"`

	DefaultCode  gosql.NullableJSON[map[string]string]  `gorm:"type:JSONB" json:"default_code,omitempty"`
	Context      gosql.NullableJSON[map[string]any]     `gorm:"type:JSONB" json:"context,omitempty"`         //
	MinECPM      float64                                `json:"min_ecpm,omitempty"`                          // Default
	MinECPMByGeo gosql.NullableJSON[map[string]float64] `gorm:"type:JSONB" json:"min_ecpm_by_geo,omitempty"` // {"CODE": <ecpm>, ...}

	// The cost of the traffic acceptance
	FixedPurchasePrice float64 `json:"fixed_purchase_price,omitempty"`

	// Filtering
	AllowedFormats    gosql.NullableStringArray                `gorm:"type:TEXT[]" json:"allowed_formats,omitempty"`
	AllowedTypes      gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"allowed_types,omitempty"`
	AllowedSources    gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"allowed_sources,omitempty"`
	DisallowedSources gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"disallowed_sources,omitempty"`

	// Strict campaigns targeting (smartlinks only)
	Campaigns gosql.NullableOrderedNumberArray[uint64] `gorm:"type:BIGINT[]" json:"campaigns,omitempty"`

	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"`
}

Zone model

func (*Zone) BeforeCreate

func (z *Zone) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

func (*Zone) GetAccountID

func (z *Zone) GetAccountID() uint64

func (*Zone) RBACResourceName

func (z *Zone) RBACResourceName() string

RBACResourceName returns the name of the resource for the RBAC

func (*Zone) RevenueShare

func (z *Zone) RevenueShare() float64

RevenueShare amount %

func (*Zone) TableName

func (z *Zone) TableName() string

TableName in database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL