Created
October 18, 2018 03:37
-
-
Save pandada8/a83c15d16cd0c40a9c2a57a0de5afb08 to your computer and use it in GitHub Desktop.
mongo-go-driver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "github.com/mongodb/mongo-go-driver/bson" | |
type Test struct { | |
Bool *bool `bson:"bool"` | |
} | |
func Bool(payload bool) *bool { | |
return &payload | |
} | |
func main() { | |
var ( | |
from = Test{Bool(false)} | |
to Test | |
) | |
buf, err := bson.Marshal(from) | |
if err != nil { | |
panic(err) | |
} | |
err = bson.Unmarshal(buf, &to) | |
if err != nil { | |
panic(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment