Documentation ¶
Overview ¶
Package trim implements methods and structures to convert users' URLs. Also it controls their consistency in the database.
Index ¶
Constants ¶
View Source
const (
// Alphabet is a sorted set of basis numeral system chars.
Alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
)
Variables ¶
View Source
var ( // ErrEmptyCallback is error about empty empty callback usage. ErrEmptyCallback = errors.New("empty callback request") )
Functions ¶
Types ¶
type CallBack ¶
type CallBack struct { URL string `bson:"u"` Method string `bson:"m"` Name string `bson:"name"` Value string `bson:"value"` }
CallBack is callback info.
type ChangeResult ¶
ChangeResult is result of CustomURL pack change.
func MultiLengthen ¶
func MultiLengthen(ctx context.Context, links []string) ([]ChangeResult, error)
MultiLengthen returns short URLs info for slice of links.
type CustomURL ¶
type CustomURL struct { ID int64 `bson:"_id"` Disabled bool `bson:"off"` Group string `bson:"group"` Tag string `bson:"tag"` Original string `bson:"orig"` User string `bson:"u"` TTL *time.Time `bson:"ttl"` NotDirect bool `bson:"ndr"` Spam float64 `bson:"spam"` Created time.Time `bson:"ts"` Modified time.Time `bson:"mod"` Cb CallBack `bson:"cb"` API bool `bson:"api"` }
CustomURL stores info about user's URL.
func Lengthen ¶
Lengthen converts a short link to original one. It uses own database session if it's needed or it gets data from the cache.
type Filter ¶
type Filter struct { Group string Tag string Period [2]*time.Time Active bool Page int PageSize int }
Filter is a data filter to export URLs info.
Click to show internal directories.
Click to hide internal directories.