Files
obitools4/autodoc/docmd/pkg/obiutils/goutils.md
T
Eric Coissac 8c7017a99d ⬆️ version bump to v4.5
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5"
- Update version.txt from 4.29 → .30
(automated by Makefile)
2026-04-13 13:34:53 +02:00

17 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# `obiutils` Package Overview
This Go package provides utility functions for common data conversion, serialization, and reflection tasks.
- **Custom Error Types**: Defines typed errors (`NotAnInteger`, `NotAFloat64`, etc.) for precise type validation failures.
- **Interface-to-Type Casting**: Offers robust conversion functions:
- `InterfaceToFloat64Map`, `InterfaceToIntSlice`, etc., handling nested interfaces and type coercion (e.g. `int``float64`, slices of `interface{}`).
- **File I/O**: `ReadLines` reads a file line-by-line into a string slice, handling buffered reading efficiently.
- **Concurrency**: `AtomicCounter` returns an incrementing integer generator—thread-safe via mutex, optionally starting from a given value.
- **JSON Serialization**: `JsonMarshal` and `JsonMarshalByteBuffer` provide UTF8preserving JSON encoding (avoids Gos default HTML escaping).
- **Reflection Helpers**:
- `IsAMap`, `IsASlice`, `IsAnArray` detect container types.
- `HasLength`, `Len`, and `IsAContainer` abstract length operations across maps, slices, arrays, or custom types with a `.Len()` method.
- **Deep Copying**: `MustFillMap` performs deep copying of nested structures using `go-deepcopy`.
All functions prioritize safety, type correctness, and usability in data-heavy or concurrent applications.