github.com/koko1123/flow-go-1@v0.29.6/model/flow/assignment/sort.go (about)

     1  package assignment
     2  
     3  import (
     4  	"github.com/koko1123/flow-go-1/model/flow"
     5  	"github.com/koko1123/flow-go-1/model/flow/order"
     6  )
     7  
     8  // FromIdentifierLists creates a `flow.AssignmentList` with canonical ordering from
     9  // the given `identifierLists`.
    10  func FromIdentifierLists(identifierLists []flow.IdentifierList) flow.AssignmentList {
    11  	assignments := make(flow.AssignmentList, 0, len(identifierLists))
    12  	// in place sort to order the assignment in canonical order
    13  	for _, identities := range identifierLists {
    14  		assignment := flow.IdentifierList(identities).Sort(order.IdentifierCanonical)
    15  		assignments = append(assignments, assignment)
    16  	}
    17  	return assignments
    18  }