advert

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Contype = echo.NewKVData()
	AdMode  = echo.NewKVData()
)
View Source
var ErrAdSlotDoesNotExist = errors.New(`ad slot does not exist`)

Functions

func GenAdvertCondition

func GenAdvertCondition() db.Compounds

func Render

func Render(v Adverter) string

Types

type AdItem

type AdItem struct {
	*dbschema.OfficialAdItem
}

func NewAdItem

func NewAdItem(ctx echo.Context) *AdItem

func (*AdItem) Add

func (f *AdItem) Add() (pk interface{}, err error)

func (*AdItem) Edit

func (f *AdItem) Edit(mw func(db.Result) db.Result, args ...interface{}) error

func (*AdItem) Exists

func (f *AdItem) Exists(name string) (bool, error)

func (*AdItem) ExistsOther

func (f *AdItem) ExistsOther(name string, id uint64) (bool, error)

type AdPosition

type AdPosition struct {
	*dbschema.OfficialAdPosition
}

func NewAdPosition

func NewAdPosition(ctx echo.Context) *AdPosition

func (*AdPosition) Add

func (f *AdPosition) Add() (pk interface{}, err error)

func (*AdPosition) Edit

func (f *AdPosition) Edit(mw func(db.Result) db.Result, args ...interface{}) error

func (*AdPosition) Exists

func (f *AdPosition) Exists(name string, ident string, excludeId uint64) error

func (*AdPosition) GetAdvertsByIdent

func (f *AdPosition) GetAdvertsByIdent(idents ...string) (map[string][]*ItemResponse, error)

func (*AdPosition) GetIDByIdent

func (f *AdPosition) GetIDByIdent(ident string) (uint64, error)

func (*AdPosition) GetOneAdvertByIdent

func (f *AdPosition) GetOneAdvertByIdent(ident string) (*dbschema.OfficialAdItem, error)

type AdPublisher

type AdPublisher struct {
	*dbschema.OfficialAdPublisher
}

func NewAdPublisher

func NewAdPublisher(ctx echo.Context) *AdPublisher

func (*AdPublisher) Add

func (f *AdPublisher) Add() (pk interface{}, err error)

func (*AdPublisher) Edit

func (f *AdPublisher) Edit(mw func(db.Result) db.Result, args ...interface{}) error

func (*AdPublisher) Exists

func (f *AdPublisher) Exists(ownerType string, ownerID uint64) (bool, error)

func (*AdPublisher) ExistsOther

func (f *AdPublisher) ExistsOther(ownerType string, ownerID uint64, id uint64) (bool, error)

type AdSettings

type AdSettings struct {
	*dbschema.OfficialAdSettings
}

func NewAdSettings

func NewAdSettings(ctx echo.Context) *AdSettings

func (*AdSettings) Add

func (f *AdSettings) Add() (pk interface{}, err error)

func (*AdSettings) Edit

func (f *AdSettings) Edit(mw func(db.Result) db.Result, args ...interface{}) error

func (*AdSettings) Exists

func (f *AdSettings) Exists(name string) (bool, error)

func (*AdSettings) ExistsOther

func (f *AdSettings) ExistsOther(name string, id uint64) (bool, error)

func (*AdSettings) List

func (f *AdSettings) List(filter Filter, offset, size int) error

TODO: unimplemented

type Adverter

type Adverter interface {
	GetWidth() uint
	GetHeight() uint
	GetURL() string
	GetContent() string
	GetContype() string
}

type ContentRenderer

type ContentRenderer func(Adverter) string

type Filter

type Filter struct {
	Client string
	AreaID uint
	Age    uint
	NowTS  int64
	Gendar string
}

func (*Filter) GenCond

func (f *Filter) GenCond() *db.Compounds

type ItemAndPosition

type ItemAndPosition struct {
	*dbschema.OfficialAdItem
	Rendered   string
	AdPosition *dbschema.OfficialAdPosition `db:"-,relation=id:position_id|gtZero"`
}

func (*ItemAndPosition) GetContent

func (i *ItemAndPosition) GetContent() string

func (*ItemAndPosition) GetContype

func (i *ItemAndPosition) GetContype() string

func (*ItemAndPosition) GetHeight

func (i *ItemAndPosition) GetHeight() uint

func (*ItemAndPosition) GetURL

func (i *ItemAndPosition) GetURL() string

func (*ItemAndPosition) GetWidth

func (i *ItemAndPosition) GetWidth() uint

type ItemAndRendered

type ItemAndRendered struct {
	*dbschema.OfficialAdItem
	Rendered string
}

type ItemResponse

type ItemResponse struct {
	Content  string `json:"content" xml:"content"`
	Contype  string `json:"contype" xml:"contype"`
	URL      string `json:"url" xml:"url"`
	Start    uint   `json:"start,omitempty" xml:"start,omitempty"`
	End      uint   `json:"end,omitempty" xml:"end,omitempty"`
	Width    uint   `json:"width,omitempty" xml:"width,omitempty"`
	Height   uint   `json:"height,omitempty" xml:"height,omitempty"`
	Rendered string `json:"rendered,omitempty" xml:"rendered,omitempty"`
}

func NewItemResponse

func NewItemResponse(item *dbschema.OfficialAdItem, position *dbschema.OfficialAdPosition) *ItemResponse

func (*ItemResponse) GenHTML

func (i *ItemResponse) GenHTML() *ItemResponse

func (*ItemResponse) GetContent

func (i *ItemResponse) GetContent() string

func (*ItemResponse) GetContype

func (i *ItemResponse) GetContype() string

func (*ItemResponse) GetHeight

func (i *ItemResponse) GetHeight() uint

func (*ItemResponse) GetURL

func (i *ItemResponse) GetURL() string

func (*ItemResponse) GetWidth

func (i *ItemResponse) GetWidth() uint

type PositionWithRendered

type PositionWithRendered struct {
	*dbschema.OfficialAdPosition
	Rendered string
}

func (*PositionWithRendered) GetContent

func (i *PositionWithRendered) GetContent() string

func (*PositionWithRendered) GetContype

func (i *PositionWithRendered) GetContype() string

func (*PositionWithRendered) GetHeight

func (i *PositionWithRendered) GetHeight() uint

func (*PositionWithRendered) GetURL

func (i *PositionWithRendered) GetURL() string

func (*PositionWithRendered) GetWidth

func (i *PositionWithRendered) GetWidth() uint

Jump to

Keyboard shortcuts

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