trafficrouter

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTrafficRouter = errors.New(`invalid traffic router`)
)

Functions

This section is empty.

Types

type Filter

type Filter struct {
	ID              []uint64
	AccountID       uint64
	Active          *models.ActiveStatus
	RTBSourceIDs    []uint64
	Formats         []string
	DeviceTypes     []uint64
	Devices         []uint64
	OS              []uint64
	Browsers        []uint64
	Carriers        []uint64
	Categories      []uint64
	Countries       []string
	Languages       []string
	Domains         []string
	Applications    []uint64
	Zones           []uint64
	Secure          int
	AdBlock         int
	PrivateBrowsing int
	IP              int
}

Filter of the objects list

func (*Filter) PrepareQuery

func (fl *Filter) PrepareQuery(query *gorm.DB) *gorm.DB

type ListOrder

type ListOrder struct {
	ID        models.Order
	Title     models.Order
	Active    models.Order
	Percent   models.Order
	CreatedAt models.Order
	UpdatedAt models.Order
}

ListOrder of the objects list

func (*ListOrder) PrepareQuery

func (ol *ListOrder) PrepareQuery(query *gorm.DB) *gorm.DB

type Option

type Option = repository.QOption

List select options

type Options

type Options = repository.ListOptions

List select options

type Repository

type Repository interface {
	Get(ctx context.Context, id uint64) (*models.TrafficRouter, error)
	FetchList(ctx context.Context, qops ...Option) ([]*models.TrafficRouter, error)
	Count(ctx context.Context, qops ...Option) (int64, error)
	Create(ctx context.Context, router *models.TrafficRouter) (uint64, error)
	Update(ctx context.Context, id uint64, router *models.TrafficRouter) error
	Delete(ctx context.Context, id uint64) error
	Run(ctx context.Context, id uint64, message string) error
	Pause(ctx context.Context, id uint64, message string) error
	Approve(ctx context.Context, id uint64, message string) error
	Reject(ctx context.Context, id uint64, message string) error
}

type RepositoryImpl

type RepositoryImpl struct {
	repository.Repository
}

func NewRepositoryImpl

func NewRepositoryImpl() *RepositoryImpl

NewRepositoryImpl creates a new instance of RepositoryImpl.

func (*RepositoryImpl) Approve

func (rep *RepositoryImpl) Approve(ctx context.Context, id uint64, message string) error

Approve sets the TrafficRouter object to approved status.

func (*RepositoryImpl) Count

func (rep *RepositoryImpl) Count(ctx context.Context, qops ...Option) (int64, error)

Count returns the total number of TrafficRouter objects.

func (*RepositoryImpl) Create

func (rep *RepositoryImpl) Create(ctx context.Context, router *models.TrafficRouter) (uint64, error)

Create creates a new TrafficRouter object.

func (*RepositoryImpl) Delete

func (rep *RepositoryImpl) Delete(ctx context.Context, id uint64) error

Delete deletes a TrafficRouter object by ID.

func (*RepositoryImpl) FetchList

func (rep *RepositoryImpl) FetchList(ctx context.Context, qops ...Option) ([]*models.TrafficRouter, error)

FetchList retrieves a list of TrafficRouter objects.

func (*RepositoryImpl) Get

Get returns the object by id

func (*RepositoryImpl) Pause

func (rep *RepositoryImpl) Pause(ctx context.Context, id uint64, message string) error

Pause sets the TrafficRouter object to pause status.

func (*RepositoryImpl) Reject

func (rep *RepositoryImpl) Reject(ctx context.Context, id uint64, message string) error

Reject sets the TrafficRouter object to rejected status.

func (*RepositoryImpl) Run

func (rep *RepositoryImpl) Run(ctx context.Context, id uint64, message string) error

Run sets the TrafficRouter object to active status.

func (*RepositoryImpl) Update

func (rep *RepositoryImpl) Update(ctx context.Context, id uint64, router *models.TrafficRouter) error

Update updates an existing TrafficRouter object.

type Usecase

type Usecase interface {
	Get(ctx context.Context, id uint64) (*models.TrafficRouter, error)
	FetchList(ctx context.Context, qops ...Option) ([]*models.TrafficRouter, error)
	Count(ctx context.Context, qops ...Option) (int64, error)
	Create(ctx context.Context, router *models.TrafficRouter) (uint64, error)
	Update(ctx context.Context, id uint64, router *models.TrafficRouter) error
	Delete(ctx context.Context, id uint64) error
	Run(ctx context.Context, id uint64, message string) error
	Pause(ctx context.Context, id uint64, message string) error
	Approve(ctx context.Context, id uint64, message string) error
	Reject(ctx context.Context, id uint64, message string) error
}

type UsecaseImpl

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

func NewUsecaseImpl

func NewUsecaseImpl(repo Repository) *UsecaseImpl

NewUsecaseImpl creates a new instance of UsecaseImpl.

func (*UsecaseImpl) Approve

func (uc *UsecaseImpl) Approve(ctx context.Context, id uint64, message string) error

Approve approves the router by id

func (*UsecaseImpl) Count

func (uc *UsecaseImpl) Count(ctx context.Context, qops ...Option) (int64, error)

Count returns the total number of TrafficRouter objects.

func (*UsecaseImpl) Create

func (uc *UsecaseImpl) Create(ctx context.Context, router *models.TrafficRouter) (uint64, error)

Create creates a new TrafficRouter object.

func (*UsecaseImpl) Delete

func (uc *UsecaseImpl) Delete(ctx context.Context, id uint64) error

Delete removes the object by id

func (*UsecaseImpl) FetchList

func (uc *UsecaseImpl) FetchList(ctx context.Context, qops ...Option) ([]*models.TrafficRouter, error)

FetchList retrieves a list of TrafficRouter objects.

func (*UsecaseImpl) Get

Get returns the object by id

func (*UsecaseImpl) Pause

func (uc *UsecaseImpl) Pause(ctx context.Context, id uint64, message string) error

Pause stops the router by id

func (*UsecaseImpl) Reject

func (uc *UsecaseImpl) Reject(ctx context.Context, id uint64, message string) error

Reject rejects the router by id

func (*UsecaseImpl) Run

func (uc *UsecaseImpl) Run(ctx context.Context, id uint64, message string) error

Run starts the router by id

func (*UsecaseImpl) Update

func (uc *UsecaseImpl) Update(ctx context.Context, id uint64, router *models.TrafficRouter) error

Update updates an existing TrafficRouter object.

Directories

Path Synopsis
delivery

Jump to

Keyboard shortcuts

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