I’ve data as shown, I was able to read it as CSV and do sorting by time, as below:
type Interface interface {
Len() int
Less(i, j int) bool
Swap(i, j int)
}
func (t Transactions) Len() int { return len(t) }
func (t Transactions) Less(i, j int) bool {
t1, _ := time.Parse("1/2/2006 03:04:05 PM", t[i].TrxTime)
t2, _ := time.Parse("1/2/2006 03:04:05 PM", t[j].TrxTime)
return t1.Before(t2)
}
func (t Transactions) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
It is sorting by the time correctly, but found it is sorting by Warehouse
as well, the output is:
I00003 20110 320 TRF-003009
I00003 20111 320 TRF-003009
I00003 20111 -320 TRF-003009
I00003 20119 -320 TRF-003009
I00003 20119 320 Opening
How can I force sorting the data by time
ONLY ignoring other parameters, or by time
and Qty
and force the ignorance of the warehouse
code consideration?