MCPcopy Create free account
hub / github.com/Macmod/godap / sortAttributes

Function sortAttributes

tui/tree.go:773–789  ·  view source on GitHub ↗
(attrs []*ldap.EntryAttribute)

Source from the content-addressed store, hash-verified

771}
772
773func sortAttributes(attrs []*ldap.EntryAttribute) []*ldap.EntryAttribute {
774 sortedAttrs := make([]*ldap.EntryAttribute, len(attrs))
775 copy(sortedAttrs, attrs)
776
777 switch AttrSort {
778 case "asc":
779 sort.Slice(sortedAttrs, func(i, j int) bool {
780 return sortedAttrs[i].Name <= sortedAttrs[j].Name
781 })
782 case "desc":
783 sort.Slice(sortedAttrs, func(i, j int) bool {
784 return sortedAttrs[i].Name > sortedAttrs[j].Name
785 })
786 }
787
788 return sortedAttrs
789}
790
791func getName(entry *ldap.Entry) string {
792 nameIds := []string{"cn", "ou", "dc", "name", "uid"}

Callers 1

reloadAttributesPanelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected