github.com/isyscore/isc-gobase@v1.5.3-0.20231218061332-cbc7451899e9/isc/range.go (about)

     1  package isc
     2  
     3  func Int(AStart, AEnd int) []int {
     4  	var ret []int
     5  	for i := AStart; i < AEnd; i++ {
     6  		ret = append(ret, i)
     7  	}
     8  	return ret
     9  }
    10  
    11  func Int64(AStart, AEnd int64) []int64 {
    12  	var ret []int64
    13  	for i := AStart; i < AEnd; i++ {
    14  		ret = append(ret, i)
    15  	}
    16  	return ret
    17  }
    18  
    19  func IntStep(AStart, AEnd, AStep int) []int {
    20  	var ret []int
    21  	for i := AStart; i < AEnd; i += AStep {
    22  		ret = append(ret, i)
    23  	}
    24  	return ret
    25  }
    26  
    27  func Int64Step(AStart, AEnd, AStep int64) []int64 {
    28  	var ret []int64
    29  	for i := AStart; i < AEnd; i += AStep {
    30  		ret = append(ret, i)
    31  	}
    32  	return ret
    33  }
    34  
    35  type MapPair[K comparable, V comparable] struct {
    36  	Key   K
    37  	Value V
    38  }
    39  
    40  func OrderMapToList[K comparable, V comparable](m OrderMap[K, V]) []MapPair[K, V] {
    41  	var n []MapPair[K, V]
    42  	for _, key := range m.Keys() {
    43  		n = append(n, MapPair[K, V]{key, m.Data[key]})
    44  	}
    45  	return n
    46  }