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

Use unique struct comment tag name #44

Open
ftKnox opened this issue Jun 27, 2017 · 2 comments
Open

Use unique struct comment tag name #44

ftKnox opened this issue Jun 27, 2017 · 2 comments

Comments

@ftKnox
Copy link
Contributor

ftKnox commented Jun 27, 2017

It would be beneficial and make it more inline with many other go drivers for other databases to use a unique name for the json marshal/unmarshalling. One specific use case is have a particular field used as a query field but I don't want that field saved to the database. In the example below i may have an http request with "parent_container_id" populated to have it search for a particular container, but I don't need that data saved into arangodb. So currently I am forced to build an additional struct just to omit that field.

type Container {
 ID string `json:"_key"`
}
type Item {
  *Container `json:"container"`
  ParentContainerID string `json:"parent_container_id"`
}

// something like this would be preferable
type Item {
  *Container `json:"container"`
  ParentContainerID string `arangodb:"-" json:"parent_container_id"`
}
@ewoutp
Copy link
Contributor

ewoutp commented Jun 30, 2017

Let me see if I understand you correctly.
You want an additional tag that overwrites the json tag when both exist. Right?

I assume the semantics of that tag should be identical to the json tag.

If so. This is something that we have been discussing. I'll revive that discussion.

@ftKnox
Copy link
Contributor Author

ftKnox commented Jun 30, 2017

Yeah it's how the gorethink and mgo drivers work for rethinkdb and mongodb.

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

No branches or pull requests

2 participants