hzDocs

evendeep(-go)

Colored logger in golang

Intro to evendeep

This is a standard deepcopy library. It provides per-field copying deeply, and compares deeply abilities.

This library is designed for making everything customizable.

Features

  • loosely and reasonable data-types conversions, acrossing primitives, composites and functions, with customizable converters/transformers

  • unexported values (optional), ...

  • circular references immunization

  • fully customizable

    • user-defined value/type converters/transformers
    • user-defined field to field name converting rule via struct Tag
  • easily apply different strategies

    • basic strategies are: copy-n-merge, clone,
    • strategies per struct field: slicecopy, slicemerge, mapcopy, mapmerge, omitempty (keep if source is zero or nil), omitnil, omitzero, keepneq (keep if not equal), cleareq (clear if equal), ...
  • copy fields by name or ordinal

    • field to field
    • field to method, method to field
    • value to function (as input), function result to value
    • slice[0] to struct, struct to slice[0]
    • struct to map, map to struct
    • User-defined extractor/getter on various source
    • User-defined setter for struct or map target (if mapkey is string)
    • ...
  • The deep series

  • Compatibilities

    • Run for Go Modules and Generics enable, and log/slog present (go1.21+ since v1)
      • since v1, debug/buildinfo requires go1.18+, log/slog wants go1.21+.
      • for the v0.x versions, go1.11+ is okay.

History

Roadmap

These features had been planning but still on ice.

  • Name converting and mapping for cms.ByOrdinal (*) mode: a universal name converter can be applied in copying field to field.
  • Use SourceExtractor and TargetSetter together (might be impossible)
  • More builtin converters (might not be a requisite)
  • Handle circular pointer (DONE)

Issue me if you wanna put it or them on the table.

LICENSE

Apache 2.0

How is this guide?

Edit on GitHub

Last updated on

On this page