biz

package
v0.0.0-...-c30d74c Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 8 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Leaf

type Leaf struct {
	ID        int64
	BizTag    string
	MaxID     int64
	Step      int64
	Desc      string
	Version   int32
	CreatedAt int64
	UpdatedAt int64
}

type LeafRepo

type LeafRepo interface {
	Save(context.Context, *Leaf) (int64, error)
	Update(context.Context, int64, *Leaf) error
	Find(context.Context, int64) (*Leaf, error)
	FindByBizTag(context.Context, string) (*Leaf, error)
	CountByBizTag(context.Context, string) (int, error)
	ListAll(context.Context) ([]*Leaf, error)
	UpdateBuffer(context.Context, int64) ([]int64, error)
}

type LeafUseCase

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

func NewLeafUseCase

func NewLeafUseCase(repo LeafRepo, logger log.Logger, config *conf.App) *LeafUseCase

func (*LeafUseCase) CountByBizTag

func (lu *LeafUseCase) CountByBizTag(ctx context.Context, bizTag string) (int, error)

func (*LeafUseCase) FindByBizID

func (lu *LeafUseCase) FindByBizID(ctx context.Context, bizID int64) (*Leaf, error)

func (*LeafUseCase) GetID

func (lu *LeafUseCase) GetID(ctx context.Context) int64

func (*LeafUseCase) Save

func (lu *LeafUseCase) Save(ctx context.Context, leaf *Leaf) (int64, error)

type ShortUrl

type ShortUrl struct {
	ID        int64
	BizID     int64
	Origin    string
	ShortInt  int64
	CreatedAt int64
	UpdatedAt int64
	ExpiredAt int64
	NeedCheck bool
}

type ShortUrlRepo

type ShortUrlRepo interface {
	Save(context.Context, *ShortUrl) error
	Update(context.Context, int64, *ShortUrl) error
	Find(context.Context, int64) (*ShortUrl, error)
	ListAll(context.Context) ([]*ShortUrl, error)
	FindByShort(context.Context, string) (*ShortUrl, error)
	UpdateUrlCount(context.Context, int64, int64) error
}

type ShortUrlUseCase

type ShortUrlUseCase struct {
	ShortUrlRepo ShortUrlRepo
	LeafRepo     LeafRepo
	// contains filtered or unexported fields
}

func NewShortUrlUseCase

func NewShortUrlUseCase(repo ShortUrlRepo, leafRepo LeafRepo, logger log.Logger) *ShortUrlUseCase

func (*ShortUrlUseCase) CountForever

func (su *ShortUrlUseCase) CountForever(ctx context.Context)

func (*ShortUrlUseCase) FindByShort

func (su *ShortUrlUseCase) FindByShort(ctx context.Context, short string) (*ShortUrl, error)

func (*ShortUrlUseCase) Save

func (su *ShortUrlUseCase) Save(ctx context.Context, short *ShortUrl) error

func (*ShortUrlUseCase) UpdateVisitCount

func (su *ShortUrlUseCase) UpdateVisitCount(ctx context.Context, id int64)

UpdateVisitCount url visit count + 1

Jump to

Keyboard shortcuts

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