base62

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaNamePrefix = "_"
)

Variables

View Source
var (
	ErrEmptyTenantID           = errors.New("empty tenant ID")
	ErrDecodingSchemaName      = errors.New("error decoding schema name")
	ErrEncodedSchemaNameLength = errors.New("encoded schema name has invalid length")
)

Functions

func DecodeSchemaNameBase62

func DecodeSchemaNameBase62(encoded string) (string, error)

func EncodeSchemaNameBase62

func EncodeSchemaNameBase62(input string) (string, error)

EncodeSchemaNameBase62 encodes the input string using base62 encoding and returns a schema name prefixed with SchemaNamePrefix. The resulting encoded schema name must be between 3 and 62 characters long. Returns an error if the input is empty or the encoded length is out of bounds.

Postgresql allows max 63 bytes for schema name. Keeps schema names in db encoding, usually UTF-8. In UTF-8, ASCII characters are 1 byte (a-z, A-Z, 0-9, _). Non-ASCII characters can be more than 1 byte. ASCII characters are 1 byte. If 63 characters long string in golang contains only ASCII characters, it will be 63 bytes long.

Types

This section is empty.

Jump to

Keyboard shortcuts

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