tools

package module
v0.0.0-...-0d95ebb Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpToJSON

func DumpToJSON(v any, i string) string

DumpToJSON is a debugging utility that marshals the given value into an indented JSON string. It accepts any value (v) to be serialized and an indentation string (i), which defaults to two spaces (" ") if empty. Since it is intended for debugging, it swallows marshal errors and returns the error message string instead.

func FormatGenericDateTimeToGolangLayout

func FormatGenericDateTimeToGolangLayout(universalLayout string) string

FormatGenericDateTimeToGolangLayout converts a universal date/time format string (e.g., "YYYY-MM-DD HH:mm:ss.SSS a") into Go's native reference time layout. It maps standard placeholders for year, month, day, hours, minutes, seconds, milliseconds, meridiem indicators (AM/PM), and timezones to their corresponding Go time layout tokens. Returns the translated string ready to be used with Go's time parsing and formatting functions.

func NewInstanceOf

func NewInstanceOf[T any]() T

NewInstanceOf utilizes generics and reflection to allocate and return a fully initialized instance of type T. If T is a value type, it returns the initialized zero value allocated in memory. If T is a pointer type, it automatically resolves the underlying struct type, allocates the necessary memory for it, and returns the valid pointer, preventing nil pointer panics.

func Print

func Print(message string, args ...any)

PrintLog writes a message to the standard output. If no extra arguments (args) are provided, it behaves like fmt.Println, printing the message directly. If extra arguments are provided, it treats the message as a format string and behaves like fmt.Printf, automatically appending a newline character.

Types

This section is empty.

Jump to

Keyboard shortcuts

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