utils

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package utils provides utility functions for encoding and decoding operations used throughout the protoc-gen-go-flags project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustDecodeBase64

func MustDecodeBase64(d string) []byte

MustDecodeBase64 decodes a base64-encoded string and returns the resulting bytes. It panics if the input string is not valid base64, following the "Must" prefix convention. This function is useful in contexts where the input is expected to be valid base64 and a panic is appropriate for error handling (such as during initialization or testing).

Parameters:

  • d: A base64-encoded string to decode

Returns:

  • []byte: The decoded byte slice

Panics:

  • If the input string is not valid base64 encoding

func MustDecodeHex

func MustDecodeHex(d string) []byte

MustDecodeHex decodes a hex-encoded string and returns the resulting bytes. It panics if the input string is not valid hexadecimal, following the "Must" prefix convention. This function is useful in contexts where the input is expected to be valid hex and a panic is appropriate for error handling (such as during initialization or testing).

Parameters:

  • d: A hex-encoded string to decode

Returns:

  • []byte: The decoded byte slice

Panics:

  • If the input string is not valid hexadecimal encoding

func ParseTimeFormat

func ParseTimeFormat(format string) string

ParseTimeFormat converts a format string name to the actual time format

func ReadAsCSV

func ReadAsCSV(val string) ([]string, error)

func WriteAsCSV

func WriteAsCSV(vals []string) (string, error)

WriteAsCSV writes a slice of strings as a CSV string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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