hashid

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LowerAlphabet = "abcdefghijklmnopqrstuvwxyz1234567890"
	UpperAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
)

Variables

View Source
var (
	ErrInvalidConfig = errors.New("hashid: invalid config")
	ErrTypeMismatch  = errors.New("hashid: mismatched type")
	ErrInvalidValue  = errors.New("hashid: invalid value")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Salt      string
	Alphabet  string
	MinLength int
}

type Encoder

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

func New

func New(cfg Config) (*Encoder, error)

func (*Encoder) Decode

func (e *Encoder) Decode(raw string) ([]int, error)

func (*Encoder) DecodeTyped

func (e *Encoder) DecodeTyped(raw string, typ int) (uint64, error)

func (*Encoder) Encode

func (e *Encoder) Encode(values ...int) (string, error)

func (*Encoder) EncodeTyped

func (e *Encoder) EncodeTyped(id uint64, typ int) (string, error)

Jump to

Keyboard shortcuts

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