Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Base62 is a string respresentation of every possible base62 character Base62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" // MaxTokenLength is the largest possible character length of a token MaxTokenLength = 10 // MinTokenLength is the smallest possible character length of a token MinTokenLength = 1 // DefaultTokenLength is the default size of a token DefaultTokenLength = 8 )
View Source
const ( // ErrTokenTooSmall is the error returned or panic'd when a base62 token is smaller than `MinTokenLength` ErrTokenTooSmall = Error("the base62 token is smaller than MinTokenLength") // ErrTokenTooBig is the error returned or panic'd when a base62 token is larger than `MaxTokenLength` ErrTokenTooBig = Error("the base62 token is larger than MaxTokenLength") // ErrInvalidCharacter is the error returned or panic'd when a non `Base62` string is being parsed ErrInvalidCharacter = Error("there was a non base62 character in the token") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Token ¶
type Token uint64
Token is an alias of an uint64 that is marshalled into a base62 encoded token
func New ¶
New returns a `Base62` encoded `Token` of *up to* `DefaultTokenLength` if you pass in a `tokenLength` between `MinTokenLength` and `MaxTokenLength` this will return a `Token` of *up to* that length instead if you pass in a `tokenLength` that is out of range it will panic
func (Token) MarshalText ¶
MarshalText implements the `encoding.TextMarsheler` interface
func (*Token) UnmarshalText ¶
UnmarshalText implements the `encoding.TextUnmarshaler` interface
Click to show internal directories.
Click to hide internal directories.