mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-04-30 12:00:39 +00:00
8c7017a99d
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.3 KiB
1.3 KiB
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 ofinterface{}).
- File I/O:
ReadLinesreads a file line-by-line into a string slice, handling buffered reading efficiently. - Concurrency:
AtomicCounterreturns an incrementing integer generator—thread-safe via mutex, optionally starting from a given value. - JSON Serialization:
JsonMarshalandJsonMarshalByteBufferprovide UTF‑8–preserving JSON encoding (avoids Go’s default HTML escaping). - Reflection Helpers:
IsAMap,IsASlice,IsAnArraydetect container types.HasLength,Len, andIsAContainerabstract length operations across maps, slices, arrays, or custom types with a.Len()method.
- Deep Copying:
MustFillMapperforms deep copying of nested structures usinggo-deepcopy.
All functions prioritize safety, type correctness, and usability in data-heavy or concurrent applications.