-
Notifications
You must be signed in to change notification settings - Fork 4
/
changelog.txt
181 lines (151 loc) · 8.41 KB
/
changelog.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/develop
0.5.2
+ Package maintenance.
+ Update dependencies.
+ Update go.mod
0.5.1
+ Package maintenance.
0.5.0
+ Breaking change (impact=high)
Methods on type Value with pointer receivers no longer perform nil receiver checks.
In the prior version calling a method with a nil receiver would return an error; in
this version a nil pointer panic will occur.
Migration steps:
Ensure you are creating set.Value correctly with calls to set.V().
Reason:
My programming style tends to be overly defensive and initially I felt any and
all methods with pointer receivers should be safe guarded by nil checks. This
is not -- in general -- how the Go standard library is designed. When using
types like bytes.Buffer or strings.Builder we are expected to instantiate and
consume them correctly. The removal of nil receiver checks in this package is
more aligned with existing Go philosophy. Furthermore Go has some of the
best tooling for testing and when used correctly should prevent panics from
occuring in production code.
+ Breaking change (impact=low)
Package error handling has been refactored to use sentinal errors compatible
with errors.Is() unwrapping.
+ This removes dependency on github.com/nofeaturesonlybugs/errors
+ Errors no longer have stack trace information when printed with %#v verb.
Migration steps:
Probably none.
Reason:
Sentinal errors and compatibility with errors.Is() is more aligned with
the general Go philosophy regarding error handling. It also removes a
dependency (on my errors package) which potential package consumers might
not want in their code base.
+ Breaking change (impact=low)
Mapper.Map returns Mapping instead of *Mapping.
+ Breaking change (impact=low)
Method receivers on type Mapping refactored to value-receivers instead of pointer-receivers.
None of the existing methods mutate the Mapping so this change should be low impact.
+ Breaking change (impact=low)
BoundMapping is now a struct and no longer an interface type.
Migration steps:
Probably none.
Reason:
When BoundMapping as an interface was originally created I envisioned multiple
such mapping types that would provide different kinds of struct access. However it has
become apparent that:
1) Not many such types have been warranted or needed and
2) PreparedMapping -- the closest type to warrant such an interface -- does not have
a method set matching BoundMapping.
+ Breaking change (impact=high)
Mapper.Bind returns (BoundMapping, error) instead of BoundMapping.
Migration steps:
Existing code calling Mapper.Bind should now check the returned error value and
discard or abandon the use of the BoundMapping if err is non-nil.
Reason:
The previous version of set allowed Mapper.Bind to be called with an unaddressable
value which would result in all (or most) methods on BoundMapping to return an error.
Changing the Mapper.Bind signature allows this checking to be performed when
a BoundMapping is being created and lessens the burden on BoundMapping methods from
performing this check and returning the proper error.
+ Breaking change (impact=low)
Value is now a value type and most methods use value receivers.
Migration steps:
Change *Value declarations to Value.
Use the Copy method to make copies if not already doing so.
Reason:
Migrating Value to a value type with value receivers reduces allocations and the
load on the garbage collector.
Internally the members of Value are either meta data that does not change or
reflect.Value types that also act as value types. So there's no real need for Value
to exist as a pointer; the one exception being the Rebind method that mutates internal
members.
+ BoundMapping
+ Rebind allows argument to be reflect.Value if-and-only-if the value stored in the
reflect.Value is compatible with the type used to created the BoundMapping.
+ Add types Slice and SlicePtr
Slice facilitates element creation and appending to []T.
SlicePtr ensures an interface{} value is *[]T or pointer chain to []T. Deserializers needing
to deserialize data into a caller-provided slice can use SlicePtr to simplify validating
the destination as well as element creation and addition to the []T.
+ Add coerce subpackage.
`coerce` is a more efficient rewrite of the type coercion facility.
+ Add path subpackage.
`path` traverses Go structs and gathers information for reflect-based or unsafe-based hiearchy
traversal. The `unsafe` traversal logic is only partially implemented.
+ Fix erroneous documentation for Value.To that indicated if Dst and Src were both pointers
with the same level of indirection that direct assignment is performed. The Value type
performs assignment by working with the values at the end of pointer chains and therefore
does not perform direct assignment of pointers.
0.4.0
+ set.Mapper
+ Add TaggedFieldsOnly field.
TaggedFieldsOnly=false means no change in behavior.
TaggedFieldsOnly=true means only exported fields with struct tags are mapped.
0.3.2
+ Bug fix. set.V(&dst).To(src) would fail when dst and src represented the same class of data
but with different bit sizes. For example set.V(&i64).To(i8(12)) would return an error stating
"conversion from int-to-int" is not supported. This has been fixed for floats, ints, and uints
and the conversion now returns an error if the assignment would result in overflow into the target.
0.3.1
+ Bug fix. set.V().To() failed when the types were different but underlying kinds were the same.
For example the following would fail:
type NewT string
var dst NewT // Type is NewT and kind is string.
src := "A regular string." // Type is string and kind is string.
set.V(&dst).To(src) // Would result in unable to coerce string-to-string error.
0.3.0
+ Breaking change migration (impact=low).
set.BoundMapping.Assignables() has a second argument. You can set this argument to nil
or pre-allocate a slice with same length as the fields argument.
+ set.BoundMapping
+ Add method Copy().
+ Add method Fields().
+ Breaking change: Assignables() (and Fields()) accept a
pre-allocated slice as their second argument.
+ set.Mapper
+ Bug fix. When iterating struct fields unexported (aka
private) fields are implicitly ignored. Previously they were
adding to the mapping and could result in errors later when
using Mapping or BoundMapping.
+ set.Mapping
+ Add field Keys.
+ Add field StructFields.
+ set.Value
+ Add method Copy().
0.2.3
+ Bug fix. BoundMapping.Assignables() did not work as expected when attempting to Scan()
results from a database query that returned NULL for columns even if the destination struct
field was a pointer. The error was the previous implementation always follows and instantiates
pointers so the Scan() was receiving a *T when it required a **T.
+ Add feature. Mapper.TreatAsScalar can be used to treat certain types as if they were
scalars when generating mappings.
0.2.2
+ Add go.mod
0.2.1
+ No API changes.
0.2.0
+ Add Mapper, Mapping, BoundMapping
+ Add TypeInfo, TypeInfoCache
+ Add global TypeCache as an instance of TypeInfoCache.
0.1.2
+ Clean golint warnings; some small refactoring.
0.1.1
+ Refactoring and increase code coverage.
0.1.0
+ Add types:
+ Value - sets data to scalars, slices, and structs with type coercion if necessary.
+ Getter - acts as value lookup when filling structs.
+ Field - intermediate type for iterating struct fields.