github.com/Finschia/finschia-sdk@v0.48.1/x/token/class/keeper/alias.go (about)

     1  package keeper
     2  
     3  import (
     4  	sdk "github.com/Finschia/finschia-sdk/types"
     5  )
     6  
     7  // iterate through the classes and perform the provided function
     8  func (k Keeper) iterateIDs(ctx sdk.Context, fn func(id string) (stop bool)) {
     9  	store := ctx.KVStore(k.storeKey)
    10  
    11  	iterator := sdk.KVStorePrefixIterator(store, idKeyPrefix)
    12  	defer iterator.Close()
    13  
    14  	for ; iterator.Valid(); iterator.Next() {
    15  		id := splitIDKey(iterator.Key())
    16  
    17  		stop := fn(id)
    18  		if stop {
    19  			break
    20  		}
    21  	}
    22  }