googleapis / googleapis/google-cloud-go

datastore: add support for omitempty in Property

Open
#6,794 0 comments 1 reaction 1 assignee Assigned to @bhshkh View on GitHub
api: datastore type: feature request
Dominant language
Go
Stars
4.5k
Forks
1.6k
Avg merge
1d 13h
Merged PRs (30d)
109

Description

Datastore does not currently provide a way to manually define omitempty in the Property struct.

The following example will not store 'Bar' in Datastore if the value = "".

``` Go
type Foo struct {
Bar string `datastore:"bar,omitempty"`
}
```
However, when defining a custom Save() method for Datastore's PropertyLoadSaver interface, there is no provided way to mimic this behavior.
I see that 'NoIndex' is a flag that provides support for the `datastore:",noindex"` tag.
If a similar flag, such as 'OmitEmpty' was provided, that would be very helpful.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.