munemo

package
v0.0.0-...-94dd193 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Munemo is a reversible numeric encoding library. It's designed to take id numbers, and present them in more human friendly forms. It does this by using a set of symbols, and doing a base conversion to them. There are a couple of known dialects.

Original: This is compatible with the original symbol set. This has the disadvantage of being variable length, and non-sortable.

Munemo2: This symbol set was developed as a replacement. All symbols are 2 characters, and it creates sortable strings.

It is inspired by the ruby library https://github.com/jmettraux/munemo.

Index

Constants

This section is empty.

Variables

View Source
var Munemo2 = dialect{
	// contains filtered or unexported fields
}

Munemo2 is a reworked set of symbols. These are alphebetically sortable.

View Source
var Original = dialect{
	// contains filtered or unexported fields
}

Orignal is the original munemo spec. It comes from https://github.com/jmettraux/munemo and is deprecated because it's non-sortable and variable length.

Functions

func Munemo

func Munemo(id int) string

Munemo is a legacy interface to munemo encoding. It defaults to the original dialect

func New

func New(opts ...Option) *munemoGenerator

New returns a munemo generator for the given dialect.

func UnMunemo

func UnMunemo(s string) (int, error)

UnMunemo is a legacy interface to reverse munemo encoding. It defaults to the original dialect.

Types

type Option

type Option func(*munemoGenerator)

Option is the functional option type for munemoGenerator

func WithDialect

func WithDialect(d dialect) Option

WithDialect defines the dialect to be used

Jump to

Keyboard shortcuts

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