service

package
v0.0.0-...-483d5da Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Info(msg string)
	Warn(msg string)
	Error(msg string)
	Debug(msg string)
	Trace(msg string)
}

type Mab

type Mab interface {
	Ucb(banners []string, clicks map[string]int, displays map[string]int) (string, error)
}

type Queues

type Queues interface {
	Publish(ctx context.Context, event models.Events) error
}

type Service

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

func New

func New(logger Logger, storage storage.RotationStorage, mab Mab, queues Queues) *Service

NewService

func (*Service) AddBanner

func (s *Service) AddBanner(ctx context.Context, bannerID string, slotID string) error

AddBanner adds a banner to the slot.

func (*Service) AddBannerDisplay

func (s *Service) AddBannerDisplay(ctx context.Context, slotID string, groupID string) (string, error)

AddBannerDisplay chooses a banner to display.

func (*Service) AddClick

func (s *Service) AddClick(ctx context.Context, bannerID string, slotID string, groupID string) error

AddClick adds a click on the banner in the group.

func (*Service) AddDisplay

func (s *Service) AddDisplay(ctx context.Context, bannerID, slotID string, groupID string) error

Adds a banner to display.

func (*Service) CountInMap

func (s *Service) CountInMap(
	bannerInSlot []models.Rotation,
	bannerClick []models.NewClick,
	bannerDisplay []models.BannerDisplay) (
	banner []string,
	bannerClickInMap map[string]int,
	bannerDisplayInMap map[string]int,
)

func (*Service) CreateBanner

func (s *Service) CreateBanner(ctx context.Context, bannerID string, description string) (string, error)

CreateBanner creates a new banner.

func (*Service) CreateGroup

func (s *Service) CreateGroup(ctx context.Context, groupID string, description string) (string, error)

CreateGroup creates a new group.

func (*Service) CreateSlot

func (s *Service) CreateSlot(ctx context.Context, slotID string, description string) (string, error)

CreateSlot creates a new slot.

func (*Service) DeleteBanner

func (s *Service) DeleteBanner(ctx context.Context, bannerID string, slotID string) error

DeleteBanner deletes the banner from the slot.

func (*Service) LoggerBegin

func (s *Service) LoggerBegin() Logger

Logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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