Last active
March 23, 2025 06:12
-
-
Save gigenthomas/2e1459e6f30b36c72b9e5eed25ad10e9 to your computer and use it in GitHub Desktop.
go-constants.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ( | |
Unknown nodeType = iota | |
Sync | |
Async | |
Fanout | |
) | |
func getNodeType(node Node) nodeType { | |
if _, isSync := node.(SyncNode); isSync { | |
return Sync | |
} | |
if _, isAsync := node.(AsyncNode); isAsync { | |
return Async | |
} | |
if _, isFanout := node.(FanoutNode); isFanout { | |
return Fanout | |
} | |
return Unknown | |
} | |
/* | |
const – Declares a group of constants. | |
iota – Automatically increments values starting from 0 within the const block. | |
Unknown nodeType = iota – Assigns 0 to Unknown, and nodeType is the type for these constants. | |
Sync – Becomes 1, as iota increments. | |
Async – Becomes 2. | |
Fanout – Becomes 3. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment