mur3shorter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Index 十进制为 61,用于截取索引数
	Index = 0b111101
	// Shift 右移位数,为 Index 所占位数
	Shift = 6
	// DefaultAlphabet 默认对应进制数字符表,长度须为 62
	DefaultAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Shorter

type Shorter struct {
	Length   int    // 生成短地址标识长度
	Alphabet []byte // 对应进制数字符表
}

Shorter murmur3 短地址映射器

func MustNewShorter

func MustNewShorter(length int64, alphabet ...string) *Shorter

MustNewShorter 新建 murmur3 短地址映射器

func NewShorter

func NewShorter(length int64, alphabet ...string) (*Shorter, error)

NewShorter 新建 murmur3 短地址映射器

func (*Shorter) Mapping

func (s *Shorter) Mapping(longURL string) string

Mapping 长地址映射成短地址标识

Jump to

Keyboard shortcuts

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