| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Rebased, renamed to GetOrEmpty |
Sorry, something went wrong.
|
Oh, the CI is rotten in this repo. It needs an update. I'll force commit this. CI did pass, but it's not being picked up. |
Sorry, something went wrong.
Brings the branch up to date with main, which has since gained `Nullable.GetOrEmpty()` (oapi-codegen#13) and the consolidated CI workflow / golangci-lint v2 Makefile changes (oapi-codegen#33). No textual conflicts: `GetOrEmpty` landed on `Nullable` while this branch's new `Value[T]` methods were appended above it, so both sides' additions are preserved as-is. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
This may sound crazy, but I am working on a codebase where we use OpenAPI schema to describe a (YAML) document. All fields (except document name) are optional so I have to work with many optional fiels. While I want to explore the new feature omitzero, I am evaluating nullable to do the heavylifting and I am not even sure if this is gonna work yet.
But I would love to have a method - workting title - Dig that does exactly what Get does but ignores the error and returns an empty value. Assuming that all fields within structs are also treated with nullable my theory is this can simulate behavior of omitzero.
Am I crazy? I think I am. Well, let’s hear from others. I am unsure about the name for such method, but I want something that is short so I came up with Dig which is probably too wild. But GetWithoutError would not work that is way too long. Also this does not have tests yet because I am unsure if you like this or if there are not flaws in my idea.