encoding

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package encoding is an internal encoding helper package.

Index

Constants

View Source
const (
	// Delimiter rune for all encodings.
	Delimiter = rune('$')

	// DelimiterStr is the string variation of Delimiter.
	DelimiterStr = string(Delimiter)
)
View Source
const (
	// ParameterDefaultItemSeparator is the default item separator.
	ParameterDefaultItemSeparator = ","

	// ParameterDefaultKeyValueSeparator is the default key value separator.
	ParameterDefaultKeyValueSeparator = "="
)

Variables

View Source
var (
	// Base64RawAdaptedEncoding is the adapted encoding for crypt purposes without padding.
	Base64RawAdaptedEncoding = base64.NewEncoding(encodeBase64Adapted).WithPadding(base64.NoPadding)
)

Functions

func Split

func Split(encodedDigest string, n int) (parts []string)

Split an encoded digest by the encoding.Delimiter.

Types

type Parameter

type Parameter struct {
	Key   string
	Value string
}

Parameter is a key value pair.

func DecodeParameterStr

func DecodeParameterStr(input string) (opts []Parameter, err error)

DecodeParameterStr is an alias for DecodeParameterStrAdvanced using item separator and key value separator of ',' and '=' respectively.

func DecodeParameterStrAdvanced

func DecodeParameterStrAdvanced(input string, sepItem, sepKV string) (opts []Parameter, err error)

DecodeParameterStrAdvanced decodes parameter strings into a []Parameter where sepItem separates each parameter, and sepKV separates the key and value.

func (Parameter) Int

func (p Parameter) Int() (int, error)

Int converts the Value to an int using strconv.Atoi.

Jump to

Keyboard shortcuts

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