package sort

import "reflect"

type ByKEKSName []reflect.StructField

func (a ByKEKSName) Len() int {
	return len(a)
}

func (a ByKEKSName) Swap(i, j int) {
	a[i], a[j] = a[j], a[i]
}

func (a ByKEKSName) Less(i, j int) bool {
	ai := a[i].Name
	aj := a[j].Name
	if len(ai) < len(aj) {
		return true
	}
	if len(ai) > len(aj) {
		return false
	}
	return ai < aj
}
