word

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ReservedCodes = 8

[math.MaxUint32 - ReservedCodes ... math.MaxUint32] are reserved special code.

Unknown is invalid code. Words must not contain Unknown code. Separator is The separetor. Users can use it for separated namespace in key. EOS is the end of string. Words must not contain EOS code.

Variables

This section is empty.

Functions

func Reverse

func Reverse(w Word)

Types

type Code

type Code uint32
const (
	Unknown Code = iota + math.MaxUint32 - ReservedCodes

	Separator
	EOS
)

func (Code) Generate

func (x Code) Generate(r *rand.Rand, size int) reflect.Value

type Word

type Word []Code

func FromBytes

func FromBytes(data []byte) Word

func WithNameSpace

func WithNameSpace(ns, key []byte) Word

func (Word) At

func (x Word) At(i int) Code

func (Word) Bytes

func (x Word) Bytes() ([]byte, error)

Bytes : inverse of FromBytes(). it's for test purpose

func (Word) UnNameSpace

func (x Word) UnNameSpace() ([]byte, []byte, error)

UnNameSpace : inverse of WithNameSpace(). it's for test purpose

Jump to

Keyboard shortcuts

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