I have a type...
type MyType struct {
Job string `json:"Job"`
Cost string `json:"Cost"`
}
A slice of this type...
var records []MyType
It is populated as follows...
records = append(records, MyType{Job: 100, Cost:234},)
records = append(records, MyType{Job: 101, Cost:4000},)
records = append(records, MyType{Job: 102, Cost:700},)
I would like to sort the 'rows' by cost descending so...
records[0].Job would equal 101 records[0].Cost would equal 4000
records[1].Job would equal 102 records[1].Cost would equal 700
records[2].Job would equal 100 records[2].Cost would equal 234
In c# i would normally use linq, but I am new to go and not sure how to go about this...