Versions in this module Expand all Collapse all v1 v1.0.0 Oct 8, 2023 Changes in this version + func GetByteLenByPartitionCount(count int) int + func GetFnv128(data string) string + func GetMd5(data string) string + func GetNewShortLinkDb(config *MysqlDbConfig) db_base.ShortLinkDbInterface + func GetShortLinkPrefix(partitionCount int, tableNum int) string + func GetTableNumFromRawLinkKey(partitionCount int, key string) int + func GetTableNumFromShortLinkPath(partitionCount int, shortLinkPath string) int + func GetUrlShortKey(url string) string + func HexStrToInt64(hexStr string) uint64 + func Int64ToHexStr(n uint64) string + func MsTimeStampToTime(timeStamp int64) time.Time + type MysqlDbConfig struct + Addr string + DatabaseName string + PartitionCount int + Password string + Port int64 + User string + type ShortLinkDao struct + Config MysqlDbConfig + Engine *xorm.Engine + func (d *ShortLinkDao) DeleteShortLink(ctx context.Context, shortLinkPath string) error + func (d *ShortLinkDao) GenShortLink(ctx context.Context, rawLink string) (*db_base.ShortLink, error) + func (d *ShortLinkDao) GenShortLinkWithExpire(ctx context.Context, rawLink string, expireAt time.Time) (*db_base.ShortLink, error) + func (d *ShortLinkDao) GetByRawLink(ctx context.Context, rawLink string) (*db_base.ShortLink, error) + func (d *ShortLinkDao) GetByShortLinkPath(ctx context.Context, shortLinkPath string) (*db_base.ShortLink, error) + func (d *ShortLinkDao) Init(config *MysqlDbConfig) error + func (d *ShortLinkDao) SetShortLinkExpire(ctx context.Context, shortLinkPath string, expireAt time.Time) error + type ShortLinkTab struct + CreateTimestamp int64 + ExpireTimestamp int64 + Id int64 + RawLink string + RawLinkKey string + ShortLinkPath string + ShortLinkType int + UpdateTimestamp int64