github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/model/flow/mapfunc/identity.go (about) 1 package mapfunc 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 ) 6 7 // WithInitialWeight returns an anonymous function that assigns the given weight value 8 // to `Identity.InitialWeight`. This function is primarily intended for testing, as 9 // Identity structs should be immutable by convention. 10 func WithInitialWeight(weight uint64) flow.IdentityMapFunc[flow.Identity] { 11 return func(identity flow.Identity) flow.Identity { 12 identity.InitialWeight = weight 13 return identity 14 } 15 } 16 17 // WithEpochParticipationStatus returns an anonymous function that assigns the given epoch participation status value 18 // to `Identity.EpochParticipationStatus`. This function is primarily intended for testing, as 19 // Identity structs should be immutable by convention. 20 func WithEpochParticipationStatus(status flow.EpochParticipationStatus) flow.IdentityMapFunc[flow.Identity] { 21 return func(identity flow.Identity) flow.Identity { 22 identity.EpochParticipationStatus = status 23 return identity 24 } 25 }