Hi Ankit,
In this example, a date is created as follows. Can you please review this?
type School struct {
Name string `json:"name,omitempty"`
Since time.Time `json:"school|since,omitempty"`
DType []string `json:"dgraph.type,omitempty"`
}
type Person struct {
Uid string `json:"uid,omitempty"`
Name string `json:"name,omitempty"`
NameOrigin string `json:"name|origin,omitempty"`
Friends []Person `json:"friends,omitempty"`
// These are facets on the friend edge.
Since *time.Time `json:"friends|since,omitempty"`
Family string `json:"friends|family,omitempty"`
Age float64 `json:"friends|age,omitempty"`
Close bool `json:"friends|close,omitempty"`
School []School `json:"school,omitempty"`
DType []string `json:"dgraph.type,omitempty"`
}
ti := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
p := Person{
Uid: "_:alice",
Name: "Alice",
NameOrigin: "Indonesia",
DType: []string{"Person"},
Friends: []Person{
Person{
Name: "Bob",
Since: &ti,
Family: "yes",
Age: 13,
Close: true,
DType: []string{"Person"},
},
Person{
Name: "Charlie",
Family: "maybe",
Age: 16,
DType: []string{"Person"},
},
},
School: []School{School{
Name: "Wellington School",
Since: ti,
DType: []string{"Institution"},
}},
}