Skip to content

Commit

Permalink
skip lower case field
Browse files Browse the repository at this point in the history
  • Loading branch information
lihongbo committed Jul 6, 2021
1 parent fe8f175 commit 866c22c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module wmi

go 1.13
5 changes: 4 additions & 1 deletion wmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ func (c *Client) loadEntity(dst interface{}, src *ole.IDispatch) (errFieldMismat
f = f.Elem()
}
n := v.Type().Field(i).Name
if n[0] < 'A' || n[0] > 'Z' {
continue
}
if !f.CanSet() {
return &ErrFieldMismatch{
StructType: of.Type(),
Expand Down Expand Up @@ -577,7 +580,7 @@ func CreateQuery(src interface{}, where string, class ...string) string {
}
b.WriteString(strings.Join(fields, ", "))
b.WriteString(" FROM ")
if len(class) > 0{
if len(class) > 0 {
b.WriteString(class[0])
} else {
b.WriteString(t.Name())
Expand Down

0 comments on commit 866c22c

Please sign in to comment.