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

Add event for internal user modification #85

Merged

Conversation

enmand
Copy link
Member

@enmand enmand commented Jan 7, 2019

Add AccountUpdated and AccountUpdatedData for internal user modification requests.

@enmand enmand requested a review from a team January 7, 2019 15:11

// AccountUpdatedData holds the event specific data
type AccountUpdatedData struct {
Reason string `json:"reason"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does json:"reason" mean that when this struct is serialized to JSON, the key will be named reason?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup!

// AccountUpdatedData holds the event specific data
type AccountUpdatedData struct {
Reason string `json:"reason"`
OldName *string `json:"old_name,omitempty"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. How many entries does this comma delimited list accept? Do they need to be ordered in a certain way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's usually json:"KEY,OPTIONS" where KEY is the encoding key, and OPTIONS are options for encoding (e.g. something like omitempty to not include it if it isn't set. Some more info if you're interested: https://golang.org/pkg/encoding/json/#Marshal

It's also more powerful than just JSON marshalling: https://github.com/golang/go/wiki/Well-known-struct-tags

@enmand enmand merged commit 1a5928c into master Jan 7, 2019
@enmand enmand deleted the dan/improvements/6798-internal-user-modification-event branch January 7, 2019 17:20
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.

2 participants