eventgenerator

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: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidMultipleItemAsSingle = errors.New("can`t convert multipleitem to single action")
)

Errors set

Functions

This section is empty.

Types

type Allocator

type Allocator[T any] func() T

Allocator object

type EventType

type EventType interface {
	// SetDateTime set date time of event
	SetDateTime(t int64)

	// EventType returns type of event
	EventType() events.Type

	// EventURL returns url of event target
	EventURL() string

	// PreparedEventURL returns prepared url of event target
	PreparedEventURL() string

	// PrepareURL prepare url for event
	PrepareURL(url string) string

	// SetEventPurchaseViewPrice set price of event
	SetEventPurchaseViewPrice(price int64) error

	// Pack event object to byte array
	Pack() events.Code

	// Unpack event object from byte array
	Unpack(data []byte, unpuckFnc ...EventUnpacFunc) error

	// Fill event object by response
	Fill(service string, event events.Type, status uint8, response adtype.Response, it adtype.ResponseItem) error
}

EventType object for event basic type interface

type EventUnpacFunc

type EventUnpacFunc = events.EventUnpacFunc

EventUnpacFunc object for event unpack function

type Generator

type Generator[EventT EventType, UserInfoT UserInfoType] interface {
	// Event object by response
	Event(event events.Type, status uint8, response adtype.Response, it adtype.ResponseItem) (EventT, error)

	// Events object list
	Events(event events.Type, status uint8, response adtype.Response, it adtype.ResponseItemCommon) []EventT

	// UserInfo event object by response
	UserInfo(response adtype.Response, it adtype.ResponseItem) (UserInfoT, error)
}

Generator object

func New

func New[EventT EventType, UserInfoT UserInfoType](
	service string,
	eventAllocator Allocator[EventT],
	userInfoAllocator Allocator[UserInfoT],
) Generator[EventT, UserInfoT]

New generator object

type LeadType

type LeadType interface {
	// String returns string representation of object
	String() string

	// EventAuctionID returns auction id of event
	EventAuctionID() string

	// SetDateTime set date time of event
	SetDateTime(t int64)

	// Pack event object to byte array
	Pack() events.Code

	// Unpack event object from byte array
	Unpack(data []byte) error

	// Fill event object by response
	Fill(item adtype.ResponseItem, response adtype.Response) error
}

LeadType object for lead basic type interface

type TestEvent

type TestEvent struct{}

TestEvent object for testing

func (*TestEvent) EventType

func (e *TestEvent) EventType() events.Type

EventType returns type of event

func (*TestEvent) EventURL

func (e *TestEvent) EventURL() string

EventURL returns url of event target

func (*TestEvent) Fill

func (e *TestEvent) Fill(service string, event events.Type, status uint8, response adtype.Response, it adtype.ResponseItem) error

Fill event object by response

func (*TestEvent) Pack

func (e *TestEvent) Pack() events.Code

Pack event object to byte array

func (*TestEvent) PrepareURL

func (e *TestEvent) PrepareURL(url string) string

PrepareURL prepare url for event

func (*TestEvent) PreparedEventURL

func (e *TestEvent) PreparedEventURL() string

PreparedEventURL returns prepared url of event target

func (*TestEvent) SetDateTime

func (e *TestEvent) SetDateTime(t int64)

SetDateTime set date time of event

func (*TestEvent) SetEventPurchaseViewPrice

func (e *TestEvent) SetEventPurchaseViewPrice(price int64) error

SetEventPurchaseViewPrice set price of event

func (*TestEvent) Unpack

func (e *TestEvent) Unpack(data []byte, unpuckFnc ...EventUnpacFunc) error

Unpack event object from byte array

type TestLead

type TestLead struct{}

TestLead object for testing

func (*TestLead) EventAuctionID

func (l *TestLead) EventAuctionID() string

EventAuctionID returns auction id of event

func (*TestLead) Fill

func (l *TestLead) Fill(item adtype.ResponseItem, response adtype.Response) error

Fill event object by response

func (*TestLead) Pack

func (l *TestLead) Pack() events.Code

Pack event object to byte array

func (*TestLead) SetDateTime

func (l *TestLead) SetDateTime(t int64)

SetDateTime set date time of event

func (*TestLead) String

func (l *TestLead) String() string

String returns string representation of object

func (*TestLead) Unpack

func (l *TestLead) Unpack(data []byte) error

Unpack event object from byte array

type TestUserInfo

type TestUserInfo struct{}

TestUserInfo object for testing

func (*TestUserInfo) Fill

func (u *TestUserInfo) Fill(response adtype.Response, it adtype.ResponseItem) error

Fill user info object by response

type UserInfoType

type UserInfoType interface {
	Fill(response adtype.Response, it adtype.ResponseItem) error
}

UserInfoType object for user info basic type interface

Jump to

Keyboard shortcuts

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