An open API service providing repository metadata for many open source software ecosystems.

Package Usage: go: github.com/imdario/mergo

A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. Mergo merges same-type structs and maps by setting default values in zero-value fields. Mergo won't merge unexported (private) fields. It will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). It is ready for production use. It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc. Please keep in mind that a problematic PR broke 0.3.9. We reverted it in 0.3.10. We consider 0.3.10 as stable but not bug-free. . Also, this version adds suppot for go modules. Keep in mind that in 0.3.2, Mergo changed Merge() and Map() signatures to support transformers. We added an optional/variadic argument so that it won't break the existing code. If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with go get -u github.com/imdario/mergo. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). Do your usual installation procedure: You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as they are zero values too. Also, maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). Also, you can merge overwriting values using the transformer WithOverride. Additionally, you can map a map[string]interface{} to a struct (and otherwise, from struct to map), following the same restrictions as in Merge(). Keys are capitalized to find each corresponding exported field. Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as map[string]interface{}. They will be just assigned as values. Here is a nice example: Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, time.Time is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero time.Time? If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): https://twitter.com/im_dario Written by Dario Castañé: https://da.rio.hn BSD 3-Clause license, as Go language.
16 versions
Latest release: almost 2 years ago
29,734 dependent packages

View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/imdario/mergo

Dependent Repos 26

elhadjabdoulaye.diallo.etu/pji_ros1_go

Last synced: 12 months ago - Pushed: 11 months ago

swh/infra/ci-cd/3rdparty/cert-manager-webhook-gandi

Last synced: 7 months ago - Pushed: 11 months ago

radiofrance/dib
An opinionated docker image builder

Size: 3.61 MB - Last synced: 7 days ago - Pushed: 7 days ago

betagouv/sealed-secrets Fork of bitnami-labs/sealed-secrets
A Kubernetes controller and tool for one-way encrypted Secrets

Size: 19.2 MB - Last synced: 7 days ago - Pushed: almost 3 years ago

cea-hpc/fabricmon Fork of dswarbrick/fabricmon
InfiniBand fabric monitoring daemon written in Go

Size: 404 KB - Last synced: 7 days ago - Pushed: 6 months ago

1024pix/data-processing-spark-submit Fork of ovh/data-processing-spark-submit
Spark CLI wrapper to run your jobs on OVHcloud Data Processing

Size: 81.1 KB - Last synced: 3 days ago - Pushed: 12 months ago

signaux-faibles/opensignauxfaibles Fork of entrepreneur-interet-general/opensignauxfaibles
Plateforme de détection des entreprises fragiles

Size: 36.6 MB - Last synced: 7 days ago - Pushed: 3 months ago

signaux-faibles/libwekan

Size: 218 KB - Last synced: 7 days ago - Pushed: 11 months ago

signaux-faibles/IamUpdater
keycloakUpdater pour Signaux-Faibles

Size: 615 KB - Last synced: 7 days ago - Pushed: 11 months ago

signaux-faibles/datapi
datAPI - API des applications web signaux-faibles

Size: 43.1 MB - Last synced: 7 days ago - Pushed: about 1 month ago

signaux-faibles/prepare-import
📥 Scripts de préparation à l'importation de données dans le processus d'intégration

Size: 276 KB - Last synced: 7 days ago - Pushed: 4 months ago

radiofrance/helm-chart-sonarqube Fork of SonarSource/helm-chart-sonarqube

Size: 2.99 MB - Last synced: 7 months ago - Pushed: 9 months ago

csan/csan
CSAN : A marketplace for science

Last synced: 7 months ago

fantastic-fanfare/adorable_alien

Last synced: 7 months ago