forked from StackExchange/wmi
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow missing and null pointer fields to be nil.
This commit ensures missing fields for pointer field types remain nil: * This allows one to distinguish the field wasn't present from the field being NULL when the PtrNil option is false. * This also makes it more convenient to reuse structs with pointer field types with various encoders like the standard library JSON marshaler, where you may want to omit a field if it didn't exist in the queried results. The expectations around this change are captured in the TestMissingFields test. In addition, it also fixes an edge case where even with PtrNil set to true, pointer field types would always return with a pointer to a zero value instead of being nil even when the query property's value is VT_NULL. This fix is checked by the TestNullPointerField test.
- Loading branch information
Showing
4 changed files
with
94 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package wmi | ||
|
This file contains 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
This file contains 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
This file contains 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