Skip to content

Implement "omitalways" tag to allow decode yet prevent encode.#390

Open
Nifty255 wants to merge 1 commit intoglobalsign:developmentfrom
Nifty255:feature/omitalways
Open

Implement "omitalways" tag to allow decode yet prevent encode.#390
Nifty255 wants to merge 1 commit intoglobalsign:developmentfrom
Nifty255:feature/omitalways

Conversation

@Nifty255
Copy link
Copy Markdown

A developer may wish to decode or otherwise assign to a struct field but not re-encode. For example, a MongoDB document struct with a struct pointer inside for relationships:

type User struct {
  Email     string    `bson:"email"`
  Sessions  []Session `bson:"sessions,omitalways"`
}

This is accomplished via the following set of implementations:

  • Implement flag in fieldInfo struct.
  • Implement flag detection and assignment to fieldInfo struct.
  • Implement skip-encode on flag true.
  • Implement documentation and examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant