bytedance/sonic

Support configure tag when marshal/unmarshal

Ouverte

#440 ouverte le 29 mai 2023

 (15 commentaires) (0 réaction) (0 personne assignée)Go (454 forks)github user discovery
enhancementgood first issue

Métriques du dépôt

Stars
 (9 488 étoiles)
Métriques de merge PR
 (Merge moyen 12j 6h) (3 PRs mergées en 30 j)

Description

For example, I have a struct as follows, I want the id field to be omitted in json when writing http response, so I set tag json:"-", it's ok。 But when I want to marshal the same struct to redis (or unmarshal from redis) , I want the id field not to be omitted .So would you please allow developers to decide whether to ignore tag when marshal/unmarshal

type Example struct { Id int64 json:"-" IdStr string json:"id" }

Guide contributeur