shortid

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base58

type Base58 struct{}

Base58 shortens ID using a Flickr base58 encoding

func NewBase58Service

func NewBase58Service() *Base58

NewBase58Service creates a new base58 short ID service

func (*Base58) Decode

func (b *Base58) Decode(input string) (entities.ID, error)

Decode converts a short ID to an UUID

func (*Base58) Encode

func (b *Base58) Encode(input entities.ID) string

Encode converts an UUID to a short ID

type Fake

type Fake struct{}

Fake returns the input unchanged

func NewFakeService

func NewFakeService() *Fake

NewFakeService creates a new fake short ID service

func (*Fake) Decode

func (f *Fake) Decode(input string) (entities.ID, error)

Decode converts a short ID to an UUID

func (*Fake) Encode

func (f *Fake) Encode(input entities.ID) string

Encode converts an UUID to a short ID

type Service

type Service interface {
	// Encode converts an UUID to a short ID
	Encode(input entities.ID) string

	// Decode converts a short ID to an UUID
	Decode(input string) (entities.ID, error)
}

Service interface

Jump to

Keyboard shortcuts

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