types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 22 Imported by: 24

Documentation

Index

Constants

View Source
const (
	ApplicationUndefined     ApplicationType = 0
	ApplicationSite          ApplicationType = 1
	ApplicationApp           ApplicationType = 2
	ApplicationGame          ApplicationType = 3
	ApplicationUndefinedName                 = `undefined`
	ApplicationSiteName                      = `site`
	ApplicationAppName                       = `application`
	ApplicationGameName                      = `game`
)

Application type

View Source
const (
	StatusPending      ApproveStatus = 0
	StatusApproved     ApproveStatus = 1
	StatusRejected     ApproveStatus = 2
	StatusPendingName                = `pending`
	StatusApprovedName               = `approved`
	StatusRejectedName               = `rejected`
)

Status approve

View Source
const (
	FormatFieldStringType  FormatFieldType = "string"
	FormatFieldIntType                     = "int"
	FormatFieldFloatType                   = "float"
	FormatFieldBoolType                    = "bool"
	FormatFieldPhoneType                   = "phone"
	FormatFieldHTMLType                    = "html"
	FormatFieldDefaultType                 = FormatFieldStringType
)

Format Field types

View Source
const (
	FormatFieldTitle        = "title"
	FormatFieldDescription  = "description"
	FormatFieldBrandname    = "brandname"
	FormatFieldPhone        = "phone"
	FormatFieldURL          = "url"
	FormatFieldStartDisplay = "start"
	FormatFieldContent      = "content"
	FormatFieldRating       = "rating"
	FormatFieldLikes        = "likes"
	FormatFieldAddress      = "address"
	FormatFieldSponsored    = "sponsored"
)

Format field defaults

View Source
const (
	FormatAssetMain = "main"
	FormatAssetIcon = "icon"
)

Format asset defaults

View Source
const (
	PlatformUndefined          PlatformType = 0
	PlatformWeb                PlatformType = 1
	PlatformDesktop            PlatformType = 2
	PlatformMobile             PlatformType = 3 // Smart.Phone & Tablet
	PlatformSmartPhone         PlatformType = 4
	PlatformTablet             PlatformType = 5
	PlatformSmartTV            PlatformType = 6
	PlatformGameStation        PlatformType = 7
	PlatformSmartWatch         PlatformType = 8
	PlatformVR                 PlatformType = 9
	PlatformSmartGlasses       PlatformType = 10
	PlatformSmartBillboard     PlatformType = 11
	PlatformUndefinedName                   = `undefined`
	PlatformWebName                         = `web`
	PlatformDesktopName                     = `desktop`
	PlatformMobileName                      = `mobile`
	PlatformSmartPhoneName                  = `smart.phone`
	PlatformTabletName                      = `tablet`
	PlatformSmartTVName                     = `smart.tv`
	PlatformGameStationName                 = `gamestation`
	PlatformSmartWatchName                  = `smart.watch`
	PlatformVRName                          = `vr`
	PlatformSmartGlassesName                = `smart.glasses`
	PlatformSmartBillboardName              = `smart.billboard`
)

Platform type list

Variables

View Source
var ActiveStatusNameList = []string{
	`pause`,
	`active`,
}

ActiveStatusNameList contains posible active status names

ApplicationTypeNameList contains list of posible platform name

ApproveStatusNameList contains available names list

View Source
var (
	ErrFormatFieldIsRequired = errors.New("field is required")
)

Errors list...

View Source
var ErrInvalidParseVersion = fmt.Errorf("invalid parse version")
View Source
var FormatMapping = map[string]FormatType{
	`invalid`:   FormatInvalidType,
	`undefined`: FormatUndefinedType,
	`direct`:    FormatDirectType,
	`proxy`:     FormatProxyType,
	`video`:     FormatVideoType,
	`banner`:    FormatBannerType,
	`html5`:     FormatBannerHTML5Type,
	`native`:    FormatNativeType,
	`custom`:    FormatCustomType,
}

FormatMapping from name to constant

FormatTypeList of types

PlatformTypeNameList contains list of available platform names

Functions

func HoursActiveMinutes

func HoursActiveMinutes(h Hours, t time.Time) (total, elapsed int)

HoursActiveMinutes returns total active minutes for t's weekday and elapsed active minutes from midnight up to and including the current minute. Empty / all-active hours count as 24h (1440 minutes).

func TestTimeRequest

func TestTimeRequest(h Hours, utcOffsetMinutes int, pointer TimeRequestPointer) bool

TestTimeRequest checks hours for the request pointer. utcOffsetMinutes is the fixed UTC offset in minutes; a value outside [-12h, +14h] uses the request geo clock.

func TimeRequestNow

func TimeRequestNow(utcOffsetMinutes int, pointer TimeRequestPointer) time.Time

TimeRequestNow returns the clock used for hours / EVENLY pacing. utcOffsetMinutes in [-12h, +14h] is a fixed offset passed to NowUTCPlusOffset. A value outside that range uses the request geo clock.

Types

type ActiveStatus

type ActiveStatus uint

ActiveStatus of the object CREATE TYPE ActiveStatus AS ENUM ('active', 'pause')

const (
	StatusPause  ActiveStatus = 0
	StatusActive ActiveStatus = 1
)

Status active

func ActiveNameToStatus

func ActiveNameToStatus(name string) ActiveStatus

ActiveNameToStatus converts avtivity status name to status

func (ActiveStatus) IsActive

func (st ActiveStatus) IsActive() bool

IsActive status of the object

func (ActiveStatus) MarshalJSON

func (st ActiveStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (ActiveStatus) Name

func (st ActiveStatus) Name() string

Name of the status

func (*ActiveStatus) Scan

func (st *ActiveStatus) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*ActiveStatus) UnmarshalJSON

func (st *ActiveStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (*ActiveStatus) UnmarshalYAML

func (st *ActiveStatus) UnmarshalYAML(unmarshal func(any) error) error

Implements the Unmarshaler interface of the yaml pkg.

func (ActiveStatus) Value

func (st ActiveStatus) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type AdFileAssetType

type AdFileAssetType uint

AdFileAssetType represents the type of the asset

const (
	AdFileAssetUndefinedType AdFileAssetType = 0
	AdFileAssetAny                           = AdFileAssetUndefinedType
	AdFileAssetImageType     AdFileAssetType = 1
	AdFileAssetVideoType     AdFileAssetType = 2
	AdFileAssetHTML5Type     AdFileAssetType = 3
	AdFileAssetAudioType     AdFileAssetType = 4
)

AdFileAssetType values

func AdFileAssetTypeByName

func AdFileAssetTypeByName(name string) AdFileAssetType

AdFileAssetTypeByName returns adfile value type

func (AdFileAssetType) Code

func (ft AdFileAssetType) Code() string

Code of the option

func (AdFileAssetType) IsAudio

func (ft AdFileAssetType) IsAudio() bool

IsAudio file type

func (AdFileAssetType) IsHTML5

func (ft AdFileAssetType) IsHTML5() bool

IsHTML5 file type

func (AdFileAssetType) IsImage

func (ft AdFileAssetType) IsImage() bool

IsImage file type

func (AdFileAssetType) IsUndefined

func (ft AdFileAssetType) IsUndefined() bool

IsUndefined file type

func (AdFileAssetType) IsVideo

func (ft AdFileAssetType) IsVideo() bool

IsVideo file type

func (AdFileAssetType) MarshalJSON

func (ft AdFileAssetType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (AdFileAssetType) Name

func (ft AdFileAssetType) Name() string

Name of the asset

func (AdFileAssetType) Num

func (ft AdFileAssetType) Num() int

Num of the option

func (*AdFileAssetType) Scan

func (ft *AdFileAssetType) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*AdFileAssetType) UnmarshalJSON

func (ft *AdFileAssetType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (AdFileAssetType) Value

func (ft AdFileAssetType) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type AdPacing

type AdPacing uint8

AdPacing is the AdItem budget-delivery policy. CREATE TYPE AdPacing AS ENUM ('asap', 'evenly')

const (
	AdPacingASAP AdPacing = iota
	AdPacingEvenly
)

AdPacing consts. Zero value is ASAP (default).

func AdPacingByName

func AdPacingByName(name string) AdPacing

AdPacingByName string

func (AdPacing) IsEvenly

func (p AdPacing) IsEvenly() bool

IsEvenly pacing

func (AdPacing) MarshalJSON

func (p AdPacing) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (AdPacing) Name

func (p AdPacing) Name() string

Name value

func (*AdPacing) Scan

func (p *AdPacing) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (AdPacing) String

func (p AdPacing) String() string

func (*AdPacing) UnmarshalJSON

func (p *AdPacing) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (AdPacing) Value

func (p AdPacing) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type AppInfo

type AppInfo = udetect.App

type ApplicationType

type ApplicationType uint

ApplicationType type CREATE TYPE ApplicationType AS ENUM ('site', 'application', 'game')

func ApplicationTypeNameToType

func ApplicationTypeNameToType(name string) ApplicationType

ApproveNameToStatus name to const

func (ApplicationType) DisplayName

func (tp ApplicationType) DisplayName() string

DisplayName of the type

func (ApplicationType) MarshalJSON

func (tp ApplicationType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (ApplicationType) Name

func (tp ApplicationType) Name() string

Name of the type

func (*ApplicationType) Scan

func (tp *ApplicationType) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*ApplicationType) UnmarshalJSON

func (tp *ApplicationType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (ApplicationType) Value

func (tp ApplicationType) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type ApproveStatus

type ApproveStatus uint

ApproveStatus type CREATE TYPE ApproveStatus AS ENUM ('pending', 'approved', 'rejected')

func ApproveNameToStatus

func ApproveNameToStatus(name string) ApproveStatus

ApproveNameToStatus name to const

func (ApproveStatus) DisplayName

func (st ApproveStatus) DisplayName() string

DisplayName of the status

func (ApproveStatus) IsApproved

func (st ApproveStatus) IsApproved() bool

IsApproved status of the object

func (ApproveStatus) MarshalJSON

func (st ApproveStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (ApproveStatus) Name

func (st ApproveStatus) Name() string

Name of the status

func (*ApproveStatus) Scan

func (st *ApproveStatus) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*ApproveStatus) UnmarshalJSON

func (st *ApproveStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (*ApproveStatus) UnmarshalYAML

func (st *ApproveStatus) UnmarshalYAML(unmarshal func(any) error) error

Implements the Unmarshaler interface of the yaml pkg.

func (ApproveStatus) Value

func (st ApproveStatus) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type AuctionType

type AuctionType uint8

AuctionType data CREATE TYPE AuctionType AS ENUM ('undefined', 'first_price', 'second_price')

const (
	UndefinedAuctionType   AuctionType = 0
	AutoPriceAuctionType               = UndefinedAuctionType
	FirstPriceAuctionType  AuctionType = 1
	SecondPriceAuctionType AuctionType = 2
)

Auction types

func AuctionTypeNameToType

func AuctionTypeNameToType(name string) AuctionType

AuctionTypeNameToType name to const

func (AuctionType) DisplayName

func (at AuctionType) DisplayName() string

DisplayName of the auction

func (AuctionType) IsAutoPrice

func (at AuctionType) IsAutoPrice() bool

IsAutoPrice auction type

func (AuctionType) IsFirtsPrice

func (at AuctionType) IsFirtsPrice() bool

IsFirtsPrice auction type

func (AuctionType) IsSecondPrice

func (at AuctionType) IsSecondPrice() bool

IsSecondPrice auction type

func (AuctionType) MarshalJSON

func (at AuctionType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (AuctionType) Name

func (at AuctionType) Name() string

Name of the status

func (*AuctionType) Scan

func (at *AuctionType) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*AuctionType) UnmarshalJSON

func (at *AuctionType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (*AuctionType) UnmarshalYAML

func (at *AuctionType) UnmarshalYAML(unmarshal func(any) error) error

Implements the Unmarshaler interface of the yaml pkg.

func (AuctionType) Value

func (at AuctionType) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type BidFormater

type BidFormater interface {
	// List returns the list of formats
	List() []*Format

	// Bitset returns the bitset of format IDs
	Bitset() *searchtypes.NumberBitset[uint]

	// TypeMask returns the format type mask
	TypeMask() FormatTypeBitset
}

BidFormater defines the interface for managing ad formats in a bid request.

type BrowserInfo

type BrowserInfo = udetect.Browser

type CarrierInfo

type CarrierInfo = udetect.Carrier

type DeviceInfo

type DeviceInfo = udetect.Device

type FocalPoint

type FocalPoint struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

func (FocalPoint) IsValid

func (f FocalPoint) IsValid() bool

func (FocalPoint) IsZero

func (f FocalPoint) IsZero() bool

type Format

type Format struct {
	ID        uint64           `json:"id"`
	Codename  string           `json:"codename"`
	Types     FormatTypeBitset `json:"type"`
	Width     int              `json:"w"`
	Height    int              `json:"h"`
	MinWidth  int              `json:"mw,omitempty"`
	MinHeight int              `json:"mh,omitempty"`
	Config    *FormatConfig    `json:"config,omitempty"`
	// contains filtered or unexported fields
}

Format struct

func MockFormats

func MockFormats() []*Format

MockFormats for testing

func (*Format) CloneWithSize

func (f *Format) CloneWithSize(width, height, minWidth, minHeight int) *Format

CloneWithSize of current format object with the new params

func (Format) Code

func (f Format) Code() uint64

Code hash

func (Format) Compare

func (f Format) Compare(format *Format) (r int)

Compare formats

func (Format) Diagonal

func (f Format) Diagonal() float64

Diagonal of square

func (*Format) GetConfig

func (f *Format) GetConfig() *FormatConfig

GetConfig of the format object

func (Format) IsBanner

func (f Format) IsBanner() bool

IsBanner format type

func (*Format) IsCloned

func (f *Format) IsCloned() bool

IsCloned format object

func (Format) IsDirect

func (f Format) IsDirect() bool

IsDirect format type

func (*Format) IsFixed

func (f *Format) IsFixed() bool

IsFixed format

func (Format) IsNative

func (f Format) IsNative() bool

IsNative format type

func (Format) IsProxy

func (f Format) IsProxy() bool

IsProxy format type

func (*Format) IsStretch

func (f *Format) IsStretch() bool

IsStretch format

func (Format) IsVideo

func (f Format) IsVideo() bool

IsVideo format type

func (*Format) IsZero

func (f *Format) IsZero() bool

IsZero format

func (f *Format) RequiresLink() bool

RequiresLink reports whether an AdLink is mandatory for this format. A nil format or config does not require a link (LinkRequired defaults to false).

func (Format) String

func (f Format) String() string

String from format

func (Format) SuitsCompare

func (f Format) SuitsCompare(format *Format) int

SuitsCompare formats for premetive test

func (Format) SuitsCompareSize

func (f Format) SuitsCompareSize(w, h, mw, mh int) int

SuitsCompareSize for premetive test

type FormatConfig

type FormatConfig struct {
	// By default false, if true, then the link from Ad object is required
	LinkRequired bool `json:"link_required,omitempty"`

	// Assets list of the files and configs
	Assets []FormatFileRequirement `json:"assets,omitempty"`

	// By default empty, so in requirements only the link from Ad object
	Fields []FormatField `json:"fields,omitempty"`
}

FormatConfig description

func (*FormatConfig) AssetByName

func (c *FormatConfig) AssetByName(name string) *FormatFileRequirement

AssetByName from config

func (*FormatConfig) ContainsAsset

func (c *FormatConfig) ContainsAsset(asset *FormatFileRequirement, revers ...bool) bool

ContainsAsset in the list

func (*FormatConfig) GetField

func (c *FormatConfig) GetField(name string) *FormatField

GetField by name

func (*FormatConfig) Intersec

func (c *FormatConfig) Intersec(conf *FormatConfig) bool

Intersec with other format config

func (*FormatConfig) IsEmpty

func (c *FormatConfig) IsEmpty() bool

IsEmpty config

func (*FormatConfig) MainAsset

func (c *FormatConfig) MainAsset() (as *FormatFileRequirement)

MainAsset returns the main asset if exists

func (*FormatConfig) RequiredField

func (c *FormatConfig) RequiredField(fields ...string) *FormatField

RequiredField have in the config

func (*FormatConfig) RequiredFieldExcept

func (c *FormatConfig) RequiredFieldExcept(fields ...string) *FormatField

RequiredFieldExcept have any required field Fileds in param must be optional

func (*FormatConfig) SimilarField

func (c *FormatConfig) SimilarField(field *FormatField, revers ...bool) *FormatField

SimilarField in the list

func (*FormatConfig) SimpleAsset

func (c *FormatConfig) SimpleAsset() (as *FormatFileRequirement)

SimpleAsset returns the main asset in case of one required asset

type FormatField

type FormatField struct {
	// ID of the field
	ID int `json:"id,omitempty"`

	// Is required field
	Required bool `json:"required,omitempty"`

	// Title of yje field for interface
	Title string `json:"title,omitempty"`

	// Description is helper text shown under the title in the edit UI
	Description string `json:"description,omitempty"`

	// Name of the field (required)
	Name string `json:"name" validation:"required"`

	// Type of the field data
	Type FormatFieldType `json:"type,omitempty"`

	// Exclude those fields if this field is filled
	Exclude []string `json:"exclude,omitempty"`

	// Select is the choice of the available values
	Select []any `json:"select,omitempty"`

	// Minimum length for string or minimum value for int
	Min float64 `json:"min,omitempty"`

	// Maximum length for string or maximum value for int
	Max float64 `json:"max,omitempty"`

	// Mask pattern of data
	Mask string `json:"mask,omitempty"`

	// RegExp validation pattern
	RegExp string `json:"regexp,omitempty"`

	// Multiline is the minimum textarea row count; 0 means a single-line input
	Multiline int `json:"multiline,omitempty"`

	// Editable controls whether the field is shown in the general edit UI.
	// Omitted (Valid=false) or true = shown; false = hidden.
	Editable null.Bool `json:"editable,omitzero"`

	// Multilang marks the field as supporting multiple languages when editing
	Multilang bool `json:"multilang,omitempty"`
}

FormatField description

func (*FormatField) GetType

func (f *FormatField) GetType() FormatFieldType

GetType of the field

func (FormatField) IsEditable

func (f FormatField) IsEditable() bool

IsEditable reports whether the field is shown in the general edit UI. Omitted JSON (Valid=false) defaults to true.

func (FormatField) IsMultilang

func (f FormatField) IsMultilang() bool

IsMultilang reports whether the field supports multiple languages when editing.

func (FormatField) IsRequired

func (f FormatField) IsRequired() bool

IsRequired field value

func (FormatField) MaxLength

func (f FormatField) MaxLength() int

MaxLength of the field limit

func (FormatField) MultilineRows

func (f FormatField) MultilineRows() int

MultilineRows is the minimum textarea row count; 0 means a single-line input.

func (FormatField) Prepare

func (f FormatField) Prepare(value any) (result any, err error)

Prepare and validate value

func (FormatField) SoftEqual

func (f FormatField) SoftEqual(field *FormatField) bool

SoftEqual compare

type FormatFieldType

type FormatFieldType string

FormatFieldType format

type FormatFileRequirement

type FormatFileRequirement struct {
	// ID of the assert
	ID int `json:"id,omitempty"`

	// Is required file
	Required bool `json:"required,omitempty"`

	// Name of the asset asset (optional for the first asset) by default: main
	Name string `json:"name,omitempty"`

	// AdjustSize if size is bigger
	AdjustSize bool `json:"adjust_size,omitempty"`

	// Max or exact width of image or video in pixels
	Width int `json:"width,omitempty"`

	// Max or exact height of image or video in pixels
	Height int `json:"height,omitempty"`

	// Minimal allowed width of image or video in pixels
	MinWidth int `json:"min_width,omitempty"`

	// Minimal allowed height of image or video in pixels
	MinHeight int `json:"min_height,omitempty"`

	// Is animated type of file acceptable
	Animated bool `json:"animated,omitempty"`

	// Is sound acceptable
	Sound bool `json:"sound,omitempty"`

	// Thumbs settings for autogenerator
	Thumbs []string `json:"thumbs,omitempty"`

	// AllowedTypes of files (for paticular asset)
	AllowedTypes []string `json:"allowed_types,omitempty"`
}

FormatFileRequirement rule

func (FormatFileRequirement) GetName

func (f FormatFileRequirement) GetName() string

GetName of the asset

func (FormatFileRequirement) IsFixed

func (f FormatFileRequirement) IsFixed() bool

IsFixed format size

func (FormatFileRequirement) IsHTML5Support

func (f FormatFileRequirement) IsHTML5Support() bool

IsHTML5Support of the file

func (FormatFileRequirement) IsImageSupport

func (f FormatFileRequirement) IsImageSupport() bool

IsImageSupport of the file

func (FormatFileRequirement) IsMain

func (f FormatFileRequirement) IsMain() bool

IsMain asset

func (FormatFileRequirement) IsMimeTypeSupport

func (f FormatFileRequirement) IsMimeTypeSupport(mimePrefix string) bool

IsMimeTypeSupport of the file

func (*FormatFileRequirement) IsRequired

func (f *FormatFileRequirement) IsRequired() bool

IsRequired asset

func (FormatFileRequirement) IsSoundSupport

func (f FormatFileRequirement) IsSoundSupport() bool

IsSoundSupport of the file

func (FormatFileRequirement) IsVideoSupport

func (f FormatFileRequirement) IsVideoSupport() bool

IsVideoSupport of the file

func (*FormatFileRequirement) MinMaxHeight

func (f *FormatFileRequirement) MinMaxHeight() (mn, mx int)

MinMaxHeight sizes

func (*FormatFileRequirement) MinMaxWidth

func (f *FormatFileRequirement) MinMaxWidth() (mn, mx int)

MinMaxWidth sizes

func (FormatFileRequirement) SoftEqual

func (f FormatFileRequirement) SoftEqual(asset *FormatFileRequirement) bool

SoftEqual compare

type FormatType

type FormatType int

FormatType value CREATE TYPE FormatType AS ENUM ('invalid', 'undefined', 'direct', 'proxy', 'video', 'banner', 'html5', 'native', 'custom')

const (
	FormatInvalidType     FormatType = -1
	FormatUndefinedType   FormatType = 0
	FormatDirectType      FormatType = 1
	FormatProxyType       FormatType = 2
	FormatVideoType       FormatType = 3 // It's kinde of integrated into video player
	FormatBannerType      FormatType = 4
	FormatBannerHTML5Type FormatType = 5
	FormatNativeType      FormatType = 6
	FormatCustomType      FormatType = 31
)

Format types

func FormatTypeByName

func FormatTypeByName(name string) FormatType

FormatTypeByName returns format type by name

func (FormatType) DisplayName

func (t FormatType) DisplayName() string

DisplayName of the format type

func (FormatType) IsBanner

func (t FormatType) IsBanner() bool

IsBanner format type

func (FormatType) IsBannerHTML5

func (t FormatType) IsBannerHTML5() bool

IsBannerHTML5 format type

func (FormatType) IsDirect

func (t FormatType) IsDirect() bool

IsDirect format type

func (FormatType) IsInvalid

func (t FormatType) IsInvalid() bool

IsInvalid type of format

func (FormatType) IsNative

func (t FormatType) IsNative() bool

IsNative format type

func (FormatType) IsProxy

func (t FormatType) IsProxy() bool

IsProxy format type

func (FormatType) IsUndefined

func (t FormatType) IsUndefined() bool

IsUndefined type of format

func (FormatType) MarshalJSON

func (t FormatType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (FormatType) Name

func (t FormatType) Name() string

Name by format type

func (*FormatType) Scan

func (t *FormatType) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*FormatType) UnmarshalJSON

func (t *FormatType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (FormatType) Value

func (t FormatType) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type FormatTypeBitset

type FormatTypeBitset uint

FormatTypeBitset of types

const (
	// FormatTypeBitsetEmpty by default
	FormatTypeBitsetEmpty FormatTypeBitset = 0
	// FormatTypeBitsetDirect for direct type
	FormatTypeBitsetDirect FormatTypeBitset = 1 << FormatTypeBitset(FormatDirectType)
)

func NewFormatTypeBitset

func NewFormatTypeBitset(types ...FormatType) *FormatTypeBitset

NewFormatTypeBitset from types

func (FormatTypeBitset) FirstType

func (b FormatTypeBitset) FirstType() FormatType

FirstType from the bitset

func (*FormatTypeBitset) Has

func (b *FormatTypeBitset) Has(t FormatType) bool

Has type in bitset

func (FormatTypeBitset) HasOneType

func (b FormatTypeBitset) HasOneType() FormatType

HasOneType in the mask

func (FormatTypeBitset) Intersec

Intersec between two bitsets

func (*FormatTypeBitset) Is

func (b *FormatTypeBitset) Is(t FormatType) bool

Is type only

func (FormatTypeBitset) IsEmpty

func (b FormatTypeBitset) IsEmpty() bool

IsEmpty format type

func (*FormatTypeBitset) IsIntersec

func (b *FormatTypeBitset) IsIntersec(set FormatTypeBitset) bool

IsIntersec between two bitsets

func (*FormatTypeBitset) Reset

func (b *FormatTypeBitset) Reset() *FormatTypeBitset

Reset type value

func (*FormatTypeBitset) Set

func (b *FormatTypeBitset) Set(types ...FormatType) *FormatTypeBitset

Set format type values

func (*FormatTypeBitset) SetBitset

func (b *FormatTypeBitset) SetBitset(bitset ...FormatTypeBitset) *FormatTypeBitset

SetBitset intersection

func (*FormatTypeBitset) SetFromFormats

func (b *FormatTypeBitset) SetFromFormats(formats ...*Format) *FormatTypeBitset

SetFromFormats type values

func (*FormatTypeBitset) SetOne

SetOne format type value

func (*FormatTypeBitset) SetOneBitset

func (b *FormatTypeBitset) SetOneBitset(bitset FormatTypeBitset) *FormatTypeBitset

SetOneBitset set one bitset

func (FormatTypeBitset) Types

func (b FormatTypeBitset) Types() (list []FormatType)

Types list from bites

func (*FormatTypeBitset) Unset

func (b *FormatTypeBitset) Unset(types ...FormatType) *FormatTypeBitset

Unset type values

type FormatsAccessor

type FormatsAccessor interface {
	// Format list collection
	Formats() []*Format

	// FormatsBySize returns the list of acceptable formats
	FormatsBySize(w, h, minWidth, minHeight int, ftypes ...FormatTypeBitset) []*Format

	// FormatByID of the model
	FormatByID(id uint64) *Format

	// FormatByCode of the model
	FormatByCode(code string) *Format

	// DirectFormatSet to search
	DirectFormatSet() *searchtypes.NumberBitset[uint]
}

FormatsAccessor object interface

type GeoInfo

type GeoInfo = udetect.Geo

type Hours

type Hours = hourstable.Hours

Hours SQL type declaration

func HoursByString

func HoursByString(s string) (Hours, error)

HoursByString returns hours object by string pattern

type InterstitialSupport

type InterstitialSupport uint8

InterstitialSupport is the AdItem interstitial inventory policy. CREATE TYPE InterstitialSupport AS ENUM ('none', 'only', 'both')

const (
	InterstitialSupportNone InterstitialSupport = iota
	InterstitialSupportOnly
	InterstitialSupportBoth
)

InterstitialSupport consts. Zero value is None (default).

func InterstitialSupportByName

func InterstitialSupportByName(name string) InterstitialSupport

InterstitialSupportByName string. Unknown/empty names map to None.

func (InterstitialSupport) IsBoth

func (s InterstitialSupport) IsBoth() bool

IsBoth interstitial support (interstitial and non-interstitial)

func (InterstitialSupport) IsNone

func (s InterstitialSupport) IsNone() bool

IsNone interstitial support (non-interstitial only)

func (InterstitialSupport) IsOnly

func (s InterstitialSupport) IsOnly() bool

IsOnly interstitial support (interstitial only)

func (InterstitialSupport) MarshalJSON

func (s InterstitialSupport) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (InterstitialSupport) Name

func (s InterstitialSupport) Name() string

Name value

func (*InterstitialSupport) Scan

func (s *InterstitialSupport) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (InterstitialSupport) String

func (s InterstitialSupport) String() string

func (*InterstitialSupport) UnmarshalJSON

func (s *InterstitialSupport) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (InterstitialSupport) Value

func (s InterstitialSupport) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type ListFormat

type ListFormat []*Format

ListFormat array

func (ListFormat) HasSuitsCompare

func (l ListFormat) HasSuitsCompare(format *Format) bool

HasSuitsCompare in the list

type MultiTargetPointer

type MultiTargetPointer interface {
	TargetPointer
	TargetIDs() []uint64
}

MultiTargetPointer extends standart target pointer untile multi zone targetting

type OSInfo

type OSInfo = udetect.OS

type PlatformType

type PlatformType uint

PlatformType type CREATE TYPE PlatformType AS ENUM ('web', 'desktop', 'mobile', 'smart.phone', 'tablet', 'smart.tv', 'gamestation', 'smart.watch', 'vr', 'smart.glasses', 'smart.billboard')

func PlatformTypeNameToType

func PlatformTypeNameToType(name string) PlatformType

ApproveNameToStatus name to const

func (PlatformType) DisplayName

func (tp PlatformType) DisplayName() string

DisplayName of the type

func (PlatformType) MarshalJSON

func (tp PlatformType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (PlatformType) Name

func (tp PlatformType) Name() string

Name of the type

func (*PlatformType) Scan

func (tp *PlatformType) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*PlatformType) UnmarshalJSON

func (tp *PlatformType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (PlatformType) Value

func (tp PlatformType) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type PricingModel

type PricingModel uint8

PricingModel value CREATE TYPE PricingModel AS ENUM ('undefined', 'CPM', 'CPMV', 'CPC', 'CPA')

const (
	PricingModelUndefined PricingModel = iota
	PricingModelCPM
	PricingModelCPMV
	PricingModelCPC
	PricingModelCPA
)

PricingModel consts

func PricingModelByName

func PricingModelByName(model string) PricingModel

PricingModelByName string

func (PricingModel) IsCPA

func (pm PricingModel) IsCPA() bool

IsCPA model

func (PricingModel) IsCPC

func (pm PricingModel) IsCPC() bool

IsCPC model

func (PricingModel) IsCPM

func (pm PricingModel) IsCPM() bool

IsCPM model

func (PricingModel) IsCPMV

func (pm PricingModel) IsCPMV() bool

IsCPMV model

func (PricingModel) MarshalJSON

func (pm PricingModel) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (PricingModel) Name

func (pm PricingModel) Name() string

Name value

func (PricingModel) Or

Or returns current value if not undefined or alternative value

func (*PricingModel) Scan

func (pm *PricingModel) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (PricingModel) String

func (pm PricingModel) String() string

func (PricingModel) UInt

func (pm PricingModel) UInt() uint

UInt value

func (*PricingModel) UnmarshalJSON

func (pm *PricingModel) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (PricingModel) Value

func (pm PricingModel) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type PrivateStatus

type PrivateStatus uint

PrivateStatus of the object CREATE TYPE PrivateStatus AS ENUM ('public', 'private')

const (
	StatusPublic  PrivateStatus = 0
	StatusPrivate PrivateStatus = 1
)

Status private

func PrivateNameToStatus

func PrivateNameToStatus(name string) PrivateStatus

PrivateNameToStatus converts private status name to status

func (PrivateStatus) IsPrivate

func (st PrivateStatus) IsPrivate() bool

IsPrivate status of the object

func (PrivateStatus) MarshalJSON

func (st PrivateStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (PrivateStatus) Name

func (st PrivateStatus) Name() string

Name of the status

func (*PrivateStatus) Scan

func (st *PrivateStatus) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*PrivateStatus) UnmarshalJSON

func (st *PrivateStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (*PrivateStatus) UnmarshalYAML

func (st *PrivateStatus) UnmarshalYAML(unmarshal func(any) error) error

Implements the Unmarshaler interface of the yaml pkg.

func (PrivateStatus) Value

func (st PrivateStatus) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type ProcessingStatus

type ProcessingStatus int

ProcessingStatus of any item type

const (
	ProcessingUndefined ProcessingStatus = 0
	ProcessingProgress  ProcessingStatus = 1
	ProcessingProcessed ProcessingStatus = 2
	ProcessingError     ProcessingStatus = 3
	ProcessingDeleted   ProcessingStatus = 4
)

ProcessingStatus values

func ProcessingStatusByName

func ProcessingStatusByName(name string) ProcessingStatus

func (ProcessingStatus) Code

func (st ProcessingStatus) Code() string

Code returns value of status

func (ProcessingStatus) MarshalJSON

func (st ProcessingStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (ProcessingStatus) Name

func (st ProcessingStatus) Name() string

Name returns the name of status

func (*ProcessingStatus) Scan

func (st *ProcessingStatus) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*ProcessingStatus) UnmarshalJSON

func (st *ProcessingStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (ProcessingStatus) Value

func (st ProcessingStatus) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type RTBRequestType

type RTBRequestType int

RTBRequestType contains type of representation of request information CREATE TYPE RTBRequestType AS ENUM ('undefined','json','xml','protobuff','postformencoded','plain')

const (
	RTBRequestTypeUndefined       RTBRequestType = 0
	RTBRequestTypeJSON            RTBRequestType = 1
	RTBRequestTypeXML             RTBRequestType = 2
	RTBRequestTypeProtoBUFF       RTBRequestType = 3
	RTBRequestTypePOSTFormEncoded RTBRequestType = 4 // application/x-www-form-urlencoded
	RTBRequestTypePLAINTEXT       RTBRequestType = 5
)

Request types

func (RTBRequestType) MarshalJSON

func (rt RTBRequestType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (RTBRequestType) Name

func (rt RTBRequestType) Name() string

Name of the constant

func (*RTBRequestType) Scan

func (rt *RTBRequestType) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*RTBRequestType) UnmarshalJSON

func (rt *RTBRequestType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (RTBRequestType) Value

func (rt RTBRequestType) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type SimpleFormatAccessor

type SimpleFormatAccessor struct {
	// contains filtered or unexported fields
}

SimpleFormatAccessor implements basic inmemory storage of formats

func NewSimpleFormatAccessor

func NewSimpleFormatAccessor(formats []*Format) *SimpleFormatAccessor

NewSimpleFormatAccessor object

func NewSimpleFormatAccessorWithLoader

func NewSimpleFormatAccessorWithLoader(formatLoader formatLoaderFnk) *SimpleFormatAccessor

NewSimpleFormatAccessorWithLoader object

func (*SimpleFormatAccessor) DirectFormatSet

func (fa *SimpleFormatAccessor) DirectFormatSet() *searchtypes.NumberBitset[uint]

DirectFormatSet to search

func (*SimpleFormatAccessor) FormatByCode

func (fa *SimpleFormatAccessor) FormatByCode(code string) *Format

FormatByCode of the model

func (*SimpleFormatAccessor) FormatByID

func (fa *SimpleFormatAccessor) FormatByID(id uint64) *Format

FormatByID of the model

func (*SimpleFormatAccessor) Formats

func (fa *SimpleFormatAccessor) Formats() []*Format

Formats list collection

func (*SimpleFormatAccessor) FormatsBySize

func (fa *SimpleFormatAccessor) FormatsBySize(w, h, minWidth, minHeight int, fmtTypes ...FormatTypeBitset) []*Format

FormatsBySize returns the list of acceptable formats

func (*SimpleFormatAccessor) Prepare

func (fa *SimpleFormatAccessor) Prepare()

Prepare format list

func (*SimpleFormatAccessor) Reload

func (fa *SimpleFormatAccessor) Reload() error

Reload sources

type SiteInfo

type SiteInfo = udetect.Site

type TargetPointer

type TargetPointer interface {
	// BidFormater of the request
	Formats() BidFormater

	// Size of the area of visibility
	Size() (width, height int)

	// Request state and flags
	IsDebug() bool           // True if debug mode is enabled
	IsSecure() bool          // True if request is HTTPS
	IsAdBlock() bool         // True if adblock detected
	IsPrivateBrowsing() bool // True if in incognito
	IsRobot() bool           // True if bot detected
	IsProxy() bool           // True if proxy detected
	IsIPv6() bool            // True if IP is IPv6
	IsInterstitial() bool    // True if ad slot is interstitial (full-screen takeover)
	IsPush() bool            // True if ad slot is push notification

	// Device and environment
	DeviceInfo() *DeviceInfo   // Full device info
	BrowserInfo() *BrowserInfo // Browser info
	OSInfo() *OSInfo           // OS info

	// App, site, geo
	TrafficSourceID() uint64   // Traffic source ID
	AppID() uint64             // Target app ID
	AppInfo() *AppInfo         // App info
	SiteInfo() *SiteInfo       // Site info or default
	Domain() []string          // Domain list
	DomainName() string        // Main domain or bundle name
	GeoID() uint64             // Geo ID
	GeoInfo() *GeoInfo         // Geo info
	CountryCode() string       // Country code
	CarrierInfo() *CarrierInfo // Carrier info
	LanguageID() uint64        // Browser language
	LanguageCode() string      // Browser language code

	// TargetID of the specific point
	TargetID() uint64
	ExtarnalTargetID() string
	AuctionType() AuctionType // Type of auction (first price, second price, etc)

	Sex() uint // Sex of the user
	Age() uint // Age in years

	// Tags list
	Tags() []string

	// Categories of the current request
	CategoryIDs() []uint64
	CategoryCodes() []string

	// MinECPM value
	MinECPM() billing.Money

	// Time of the request start
	Time() time.Time
	CurrentGeoTime() time.Time
}

TargetPointer describer of base target params

type TimeRequestPointer

type TimeRequestPointer interface {
	CurrentGeoTime() time.Time
}

TimeRequestPointer is interface for request pointer with time

type Version

type Version struct {
	Major uint16 `json:"major"`
	Minor uint16 `json:"minor"`
	Patch uint16 `json:"patch"`
}

Version is a major.minor.patch triple. Each component fits in a uint16. Components after the third are dropped.

func IgnoreParseVersion

func IgnoreParseVersion(str string) Version

IgnoreParseVersion parses str into a Version. It returns the empty version on error.

func MustParseVersion

func MustParseVersion(str string) Version

MustParseVersion parses str into a Version. It panics on error.

func ParseVersion

func ParseVersion(str string) (Version, error)

ParseVersion parses str into a Version.

func (*Version) IsEmpty

func (v *Version) IsEmpty() bool

IsEmpty returns true if the version is empty.

func (*Version) Less

func (v *Version) Less(other Version) bool

Less returns true if v is less than other.

func (*Version) MarshalJSON

func (v *Version) MarshalJSON() ([]byte, error)

MarshalJSON returns the version as a JSON string.

func (*Version) Scan

func (v *Version) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*Version) SetFromStr

func (v *Version) SetFromStr(str string) error

SetFromStr parses str into Major, Minor, and Patch.

Leading and trailing space is ignored. An optional "v" or "V" prefix is accepted. Numbers are decimal and separated by '.' or '_'. Only the first three are stored: "145.0.0.0" is 145.0.0, "10.0" is 10.0, "10_15_7" is 10.15.7. A '-' or '+' after that prefix (semver pre-release or build), and any other trailer, is ignored: "v1.2.3-rc.1" is 1.2.3. "", "0", and "undefined" are the empty version.

A string with no number, an empty component ("10..0"), or a component above 65535 returns ErrInvalidParseVersion.

func (*Version) String

func (v *Version) String() string

String returns the version as a string.

func (*Version) UnmarshalJSON

func (v *Version) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON-encoded data and stores the result in the version.

func (Version) Value

func (v Version) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type ZoneType

type ZoneType uint

PrivateStatus of the object CREATE TYPE ZoneType AS ENUM ('zone', 'smartlink')

const (
	ZoneTypeDefault   ZoneType = iota // 0
	ZoneTypeSmartlink                 // 1
)

Zone Types enum

func ZoneNameToType

func ZoneNameToType(name string) ZoneType

ZoneNameToType converts zone type name to const

func (tp ZoneType) IsSmartlink() bool

IsSmartlink type of the object

func (ZoneType) MarshalJSON

func (st ZoneType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (ZoneType) Name

func (tp ZoneType) Name() string

Name of the status

func (*ZoneType) Scan

func (st *ZoneType) Scan(value any) error

Scan implements the driver.Valuer interface, json field interface

func (*ZoneType) UnmarshalJSON

func (st *ZoneType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (*ZoneType) UnmarshalYAML

func (st *ZoneType) UnmarshalYAML(unmarshal func(any) error) error

Implements the Unmarshaler interface of the yaml pkg.

func (ZoneType) Value

func (st ZoneType) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

Jump to

Keyboard shortcuts

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