Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rwxrob/structs
Data Structs with Go (1.18) Generics
https://github.com/rwxrob/structs
data-structures generics golang graph-structures node stack tree-structure
Last synced: 2 months ago
JSON representation
Data Structs with Go (1.18) Generics
- Host: GitHub
- URL: https://github.com/rwxrob/structs
- Owner: rwxrob
- License: apache-2.0
- Created: 2022-03-06T07:02:01.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-14T10:37:40.000Z (over 2 years ago)
- Last Synced: 2024-10-26T00:03:57.303Z (2 months ago)
- Topics: data-structures, generics, golang, graph-structures, node, stack, tree-structure
- Language: Go
- Homepage:
- Size: 115 KB
- Stars: 3
- Watchers: 2
- Forks: 4
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Data Structs with Go (1.18+) Generics
[![Go
Version](https://img.shields.io/github/go-mod/go-version/rwxrob/structs)](https://tip.golang.org/doc/go1.18)
[![GoDoc](https://godoc.org/github.com/rwxrob/structs?status.svg)](https://godoc.org/github.com/rwxrob/structs)
[![License](https://img.shields.io/badge/license-Apache2-brightgreen.svg)](LICENSE)
[![Go Report
Card](https://goreportcard.com/badge/github.com/rwxrob/structs)](https://goreportcard.com/report/github.com/rwxrob/structs)*Go report card has no idea how to handle Go 1.18.* 😀
* [Types Map](types)
* [QStack](qstack)
* [Rooted Node Tree](tree)
* [Text Sets](set/text/set)All structures make judicious use of generics and implement the same
json.AsJSON interface (and others) making them much more consumable and
shareable.## Design Decisions
* **Why no linked-list or queue?** Because they are fulfilled by QStack
and Node.* **Decided to drop async walks of Node.** It's easily accomplished by
enclosing whatever channel is needed in the iterator function and
forking a goroutine off from within it.* **Don't stutter.** `tree.Tree` was changed to `tree.E` and
`qstack.QStack` was changed to `qstack.QS` to follow the idiomatic
"don't stutter" design preferred by core Go libraries like
`testing.T`. (We don't want to be another `context.Context`.)## TODO
* Add equivalent methods to Node from JavaScript (InsertAfter, etc.)
* Add Union and other set methods