summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-11-08 16:58:52 +0100
committerxengineering <me@xengineering.eu>2024-11-08 16:58:52 +0100
commite3a3949959f3223ec69f2c60d4e620f8653dc2ff (patch)
tree10ecfb32534edf9feaffe8481c87f551e378ce1b
parent06300056ee184d7daecf2c3764c86978cec667ec (diff)
downloadoptional-go-e3a3949959f3223ec69f2c60d4e620f8653dc2ff.tar
optional-go-e3a3949959f3223ec69f2c60d4e620f8653dc2ff.tar.zst
optional-go-e3a3949959f3223ec69f2c60d4e620f8653dc2ff.zip
Add main.go with generic Optional definition
This is the core of the optional package.
-rw-r--r--optional/main.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/optional/main.go b/optional/main.go
new file mode 100644
index 0000000..6cc494a
--- /dev/null
+++ b/optional/main.go
@@ -0,0 +1,6 @@
+package optional
+
+type Optional[T any] struct {
+ Value T
+ Exists bool
+}