shorturl

package
v0.0.0-...-139d814 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: AGPL-3.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ShortURLGenerator   *shortid.Gen
	ErrLongURLExists    = errors.New(`网址已经存在`)
	ErrNeedURLPassword  = errors.New(`请输入密码`)
	ErrWrongURLPassword = errors.New(`密码错误`)
	ErrExpiredURL       = errors.New(`短网址已过期`)
	ErrNotExistsURL     = errors.New(`短网址不存在`)
)

Functions

This section is empty.

Types

type ShortURL

type ShortURL struct {
	*dbschema.OfficialShortUrl

	Domain *dbschema.OfficialShortUrlDomain
	Visit  *dbschema.OfficialShortUrlVisit
	// contains filtered or unexported fields
}

func NewShortURL

func NewShortURL(ctx echo.Context) *ShortURL

func (*ShortURL) Add

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

func (*ShortURL) Edit

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

func (*ShortURL) Exists

func (f *ShortURL) Exists(shortURL string) error

func (*ShortURL) ExistsHash

func (f *ShortURL) ExistsHash(longHash string) error

func (*ShortURL) ExistsHashOther

func (f *ShortURL) ExistsHashOther(longHash string, id uint64) error

func (*ShortURL) ExistsOther

func (f *ShortURL) ExistsOther(shortURL string, id uint64) error

func (*ShortURL) Find

func (f *ShortURL) Find(shortURL string) (longURL string, err error)

func (*ShortURL) GenVisitData

func (f *ShortURL) GenVisitData(t time.Time) error

func (*ShortURL) ParseURL

func (f *ShortURL) ParseURL(urls ...string) (urlInfo *url.URL, err error)

func (*ShortURL) VisitAdd

func (f *ShortURL) VisitAdd(t time.Time) error

func (*ShortURL) VisitListFillData

func (f *ShortURL) VisitListFillData(rows []*ShortURLVisitWithURL) ([]*ShortURLVisitWithURL, error)

func (*ShortURL) VisitListWithURL

func (f *ShortURL) VisitListWithURL(rows []*dbschema.OfficialShortUrlVisit) ([]*ShortURLVisitWithURL, error)

type ShortURLVisitWithURL

type ShortURLVisitWithURL struct {
	*dbschema.OfficialShortUrlVisit
	Num uint64 `db:"num" bson:"num" comment:"数量" json:"num" xml:"num"`
	URL *dbschema.OfficialShortUrl
}

Jump to

Keyboard shortcuts

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