Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

Nifty255
Copy link

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.

None yet

1 participant