Unable to use time.Time for datetime predicate

I have below data struct create which represents a node and its predicates in Dgraph

//Namespace Data strcuture for Dgraph database
type Namespace struct {
	Node
	Name                 string `json:"name,omitempty"`
	MarkForDeletion      bool   `json:"markfordeletion,omitempty"`
	DeleteInitiationTime string `json:"deleteinitiationtime,omitempty"`

	Owns []*Object `json:"owns,omitempty"`

	AccessedBy         []Account `json:"~access.to.namespace"`
	AccessToPermission string    `json:"access.to.namespace|permission,omitempty"`
}

The ‘DeleteInitiationTime’ predicate in Dgraph is expected to be a datetime data type and index with day.

In the above Golang code, I have the ‘DeleteInitiationTime’ as string because when I am using time.Time the commit fails with error “Transaction has been aborted. Please retry.”

Can you please suggest a solution for this?

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"},
		}},
	}