mirror of
https://github.com/status-im/status-go.git
synced 2025-01-10 06:36:32 +00:00
9d6577049f
* feat(wallet): implement balance history based on fetched transfers * Added vendor 'ttlcache'
34 lines
559 B
Go
34 lines
559 B
Go
package testutils
|
|
|
|
import "reflect"
|
|
|
|
const EthSymbol = "ETH"
|
|
const SntSymbol = "SNT"
|
|
const DaiSymbol = "DAI"
|
|
|
|
func SliceContains[T comparable](slice []T, value T) bool {
|
|
for _, v := range slice {
|
|
if v == value {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
func StructExistsInSlice[T any](target T, slice []T) bool {
|
|
for _, item := range slice {
|
|
if reflect.DeepEqual(target, item) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func Filter[T any](ss []T, test func(T) bool) (ret []T) {
|
|
for _, s := range ss {
|
|
if test(s) {
|
|
ret = append(ret, s)
|
|
}
|
|
}
|
|
return
|
|
}
|