https://github.com/xakep666/unusual_generics
Collection of unusual generics usecases in Go
https://github.com/xakep666/unusual_generics
generics golang
Last synced: 4 months ago
JSON representation
Collection of unusual generics usecases in Go
- Host: GitHub
- URL: https://github.com/xakep666/unusual_generics
- Owner: xakep666
- License: mit
- Created: 2021-09-26T08:50:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-25T10:15:29.000Z (over 4 years ago)
- Last Synced: 2024-06-20T15:43:07.662Z (about 2 years ago)
- Topics: generics, golang
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 55
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Unusual Generics
================
[](https://github.com/xakep666/unusual_generics/actions/workflows/testing.yml)
[](https://pkg.go.dev/github.com/xakep666/unusual_generics)
[](https://opensource.org/licenses/MIT)
[Type parameters](https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md) or Generics
in Go designed to reduce boilerplate for container data types like lists, graphs, etc. and functions like map, filter, reduce...
But it's possible to use them in other (I've named them 'unusual') cases. I'm collecting such cases in this repository.
What's inside:
* [Type to emulate JS 'undefined' for JSON](json_undefined.go)
* [Type to deal with non-standard time formats in JSON/XML/etc.](time_format.go)
* [Function to get pointer from literal in one line](ptr.go)
* [Generic version of x/sync/singleflight.Group](singleflight.go)
* [Wrapper for jsonb-like columns for `database/sql`](sql_json.go)
Feel free to open issue or pull request to add new one.
Note that until 1.18 release documentation on 'pkg.go.dev' will not be rendered.