Open mledezma-r7 opened 2 years ago
Issue raised as result of the following inquiry...
Is there any workaround (or plan to support) for pointers to primitive types in the Fact struct Something like this type Fact struct { Foo *string Bar *bool } The nature of my data requires value distinction after unmarshalling the following two sample json docs 1) '{"Foo": "", "Bar": false}' 2) '{}' With a Fact struct with no pointers type Fact struct { Foo string Bar bool } the resulting struct would be equivalent to this for both case 1 and 2 Fact{Foo: "", Bar: false} If we go with the struct with pointer we would get the following equivalents 1) Foo := "" Bar := false Fact{Foo: &Foo, Bar: &Bar} 2) Fact{Foo: nil, Bar: nil} Problem I'm facing is that I'm not able to pull (and evaluate) the values pointed by the pointers Keep in mind I'm starting with go, so it might be a silly question Thank you Originally posted by @mledezma-r7 in https://github.com/hyperjumptech/grule-rule-engine/discussions/263
Is there any workaround (or plan to support) for pointers to primitive types in the Fact struct
Something like this
type Fact struct { Foo *string Bar *bool }
The nature of my data requires value distinction after unmarshalling the following two sample json docs 1) '{"Foo": "", "Bar": false}' 2) '{}'
With a Fact struct with no pointers type Fact struct { Foo string Bar bool }
the resulting struct would be equivalent to this for both case 1 and 2 Fact{Foo: "", Bar: false}
If we go with the struct with pointer we would get the following equivalents 1)
Foo := "" Bar := false Fact{Foo: &Foo, Bar: &Bar}
2) Fact{Foo: nil, Bar: nil}
Fact{Foo: nil, Bar: nil}
Problem I'm facing is that I'm not able to pull (and evaluate) the values pointed by the pointers
Keep in mind I'm starting with go, so it might be a silly question Thank you
Originally posted by @mledezma-r7 in https://github.com/hyperjumptech/grule-rule-engine/discussions/263
any progress on this one?
Issue raised as result of the following inquiry...