bytes

package
v1.20.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoding

type Encoding int

Encoding represents the different encoding types for protobuf bytes fields

const (
	// EncodingRaw keeps bytes as raw binary data (default)
	EncodingRaw Encoding = iota
	// EncodingHex encodes bytes as hexadecimal string
	EncodingHex
	// EncodingHexWith0x encodes bytes as hexadecimal string with 0x prefix
	EncodingHexWith0x
	// EncodingBase64 encodes bytes as base64 string
	EncodingBase64
	// EncodingBase58 encodes bytes as base58 string
	EncodingBase58
)

func ParseEncoding

func ParseEncoding(s string) (Encoding, error)

ParseEncoding parses a string into an Encoding type

func (Encoding) DecodeBytes

func (e Encoding) DecodeBytes(encoded interface{}) ([]byte, error)

DecodeBytes decodes the given string back to bytes using the specified encoding

func (Encoding) EncodeBytes

func (e Encoding) EncodeBytes(data []byte) (interface{}, error)

EncodeBytes encodes the given bytes using the specified encoding

func (Encoding) IsStringType

func (e Encoding) IsStringType() bool

IsStringType returns true if the encoding converts bytes to string database type

func (Encoding) String

func (e Encoding) String() string

String returns the string representation of the encoding

Jump to

Keyboard shortcuts

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