basex

package
v0.0.0-...-012d1c6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Default = "0123456789bcdefghjkmnpqrstuvwxyz"
)

Variables

View Source
var (
	ErrNotSupport = errors.New("not support, string len must be 32 or 64")
)

Functions

func CheckUnique

func CheckUnique(alphabet string) bool

CheckUnique check string is unique

func Decode

func Decode(s string) uint64

func Encode

func Encode(x uint64) string

func SetDefault

func SetDefault(e *Encoding)

func Shuffle

func Shuffle(alphabet string, seed uint64) string

Shuffle a given string using Fisher–Yates shuffle Algorithm same seed will get same result

Types

type Encoding

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

base32或者base64 将uint64转换为string https://github.com/mmcloughlin/geohash/blob/master/base32.go

func NewEncoding

func NewEncoding(abc string) (*Encoding, error)

func (*Encoding) Decode

func (e *Encoding) Decode(s string) uint64

func (*Encoding) Encode

func (e *Encoding) Encode(x uint64) string

Jump to

Keyboard shortcuts

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