Testando o Generics do Go

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • lo

    💥 A Lodash-style Go library based on Go 1.18+ Generics (map, filter, contains, find...)

    package main import ( "fmt" ) func main() { s := []string{"Samuel", "Marc", "Samuel"} names := Uniq(s) fmt.Println(names) names = UniqGenerics(s) fmt.Println(names) i := []int{1, 20, 20, 10, 1} ids := UniqGenerics(i) fmt.Println(ids) } //from https://github.com/samber/lo/blob/master/slice.go func UniqGenerics[T comparable](collection []T) []T { result := make([]T, 0, len(collection)) seen := make(map[T]struct{}, len(collection)) for _, item := range collection { if _, ok := seen[item]; ok { continue } seen[item] = struct{}{} result = append(result, item) } return result } func Uniq(collection []string) []string { result := make([]string, 0, len(collection)) seen := make(map[string]struct{}, len(collection)) for _, item := range collection { if _, ok := seen[item]; ok { continue } seen[item] = struct{}{} result = append(result, item) } return result }

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts