hasher

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package hasher implements extensions for speps' go-hashids.

Index

Constants

View Source
const (
	// DefaultAlphabet is the default alphabet used for a HashIDData.
	DefaultAlphabet  = "abcdefghijklmnopqrstuvwxyz"
	DefaultMinLength = 4
	DefaultSalt      = "superspecialandrandomsalt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

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

Hasher wraps *hashids.HashID.

func Default added in v0.2.0

func Default() (*Hasher, error)

Default creates a new Hasher with predefined data.

func New

func New(data *hashids.HashIDData) (*Hasher, error)

New creates a new Hasher.

func (*Hasher) EncodeInt

func (h *Hasher) EncodeInt(i int) (string, error)

EncodeInt encodes an integer into a Hash ID.

func (*Hasher) MustEncodeInt

func (h *Hasher) MustEncodeInt(i int) string

EncodeInt encodes an integer into a Hash ID, panicking if an error occurs.

Jump to

Keyboard shortcuts

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