[GODRIVER-1337] Support inline fields as pointer to struct/map (not just struct/map) Created: 10/Oct/19 Updated: 10/Oct/19 Resolved: 10/Oct/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | BSON |
| Affects Version/s: | 1.1.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Evghenii Maslennikov | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
go 1.13, linux |
||
| Description |
|
Can't marshal/unmarshal inline structs that are under the pointer Example: package foobar import ( type MContainer struct { M int `bson:"m,omitempty"` }type FoobarWithPointer struct { *MContainer `bson:",inline"` A int }type FoobarPointerless struct { MContainer `bson:",inline"` A int }func TestSandbox(t *testing.T) { collection := client.Database("testing").Collection("numbers") _, err = collection.InsertOne(ctx, &FoobarWithPointer{A: 1, MContainer: &MContainer{M: 10}}) ``` |
| Comments |
| Comment by Esha Bhargava [ 10/Oct/19 ] |
|
Same as |