Skip to content

map is not sorted #20

@jiftle

Description

@jiftle
var rs map[string][]byte

// 排序
m := orderedmap.NewOrderedMap()
for k, _ := range rs {
	fmt.Printf("  |-set-> %v\n", el.Key)
	m.Set(k, rs[k])
}

// You can also use Back and Prev to iterate in reverse:
for el := m.Back(); el != nil; el = el.Prev() {
	fmt.Printf("  |-get-> %v\n", el.Key)
}
----> 检索记录,前缀: auth_file_rec-001203-0100000084-
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=23)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=24)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=25)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=26)]:
  |---> auth_file_rec-001203-0100000084-%!s(int=26)
  |---> auth_file_rec-001203-0100000084-%!s(int=25)
  |---> auth_file_rec-001203-0100000084-%!s(int=24)
  |---> auth_file_rec-001203-0100000084-%!s(int=23)
  
  
----> 检索记录,前缀: auth_file_rec-001203-0100000084-
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=23)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=24)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=25)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=26)]:
  |---> auth_file_rec-001203-0100000084-%!s(int=24)
  |---> auth_file_rec-001203-0100000084-%!s(int=23)
  |---> auth_file_rec-001203-0100000084-%!s(int=26)
  |---> auth_file_rec-001203-0100000084-%!s(int=25)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions