-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchangelog.txt
126 lines (98 loc) · 5.55 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
/develop
0.5.1
+ Package maintenance.
+ Update dependencies.
+ Update badges.
0.5.0
+ Update dependency github.com/nofeaturesonlybugs/set to v0.5.1
+ This release offers performance enhancements that benefit sqlh.
model
+ Models do not need to be registered via pointer.
+ Models can be registered via reflect.Type.
+ When calling methods on Models (Insert,Update,etc) slices of models can
be passed as []T or []*T
+ Add Models.Save method. Save accepts *T, []T, or []*T and will delegate
to the appropriate method (Insert,Update,Upsert) depending on the model
and the current value of its key field(s). If []T or []*T is passed then
the first element is inspected to determine the delegated method and this
method is then applied to all elements.
+ Altered Model struct definition.
+ Removed fields V, VSlice, and BoundMapping
+ Removed methods NewInstance and NewSlice
+ BindQuery method signature altered
0.4.0
+ Transact(fn) was not correctly returning the error from the call to fn(); transactions
themselves were correctly rolled back due to non-nil error returned from fn() but the
error itself was not returning to the caller.
0.3.0
+ Breaking change migration (impact=low).
+ grammar.Default renamed to grammar.Sqlite -- generated SQL is same as previous version.
+ grammar.Grammar is now an interface where methods now return (*statements.Query, error)
where previously only (*statements.Query) was returned.
+ Package grammar no longer has any panics; errors are returned instead (see previous note).
+ model.Models. Prior to this release Models only ran queries that had followup targets
for Scan() and panicked when such targets did not exist. This release allows for queries
that do not have any Scan() targets and will switch to calling Exec() instead of Query() or
QueryRow() when necessary. An implication of this change is that Models.Insert() and
Models.Update() no longer panic in the absence of Scan() targets.
grammar
+ Grammar is now an interface.
+ Global Default renamed to Sqlite.
+ Add PostgresGrammar.
+ Add SqliteGrammar.
+ Add global error vars: ErrTableRequired, ErrColumnsRequired, & ErrKeysRequired.
Grammar functions now return a variation of these errors indicating errors when building
SQL statements.
+ Add Grammar.Upsert() to support INSERT...ON CONFLICT(...) DO UPDATE queries.
hobbled
+ Package hobbled exposes facilities for hobbling database types such as *sql.DB or *sql.Tx by removing
methods such as Begin() or Prepare(). This is useful when testing the dynamic nature of sqlh and its
subpackages that can switch logic depending on the facilities of the database type given to it when
performing work.
model
+ Add global error ErrUnsupported. Models functions may return a variation of ErrUnsupported if
an operation is called on a type for which the SQL execution can not be performed.
+ QueryBinding.QueryOne() does not return an error if database/sql returns sql.ErrNoRows
and Query.Expect is equal to statements.ExpectRowOrNone.
+ QueryBinding.QuerySlice() does not return an error if database/sql returns sql.ErrNoRows
and Query.Expect is equal to statements.ExpectRowOrNone.
+ Add Models.Upsert() for models that do not have "key,auto" primary keys. Upsert() currently
only supports primary keys and does not support UNIQUE indexes.
+ Removed possible panics from Models.Insert() and Models.Update().
+ Behavior change. Prior to this release Models only ran queries that had followup targets
for Scan() and panicked when such targets did not exist. This release allows for queries
that do not have any Scan() targets and will switch to calling Exec() instead of Query() or
QueryRow() when necessary.
model/statements
+ Add ExpectRowOrNone for queries that could return 0 or 1 rows and 0 does not indicate
an error.
sqlh
+ Add functions sqlh.Transact() and sqlh.TransactRollback(). Both functions ease the use
of database transactions by wrapping a provided function argument inside a transaction.
However sqlh.TransactRollback always calls tx.Rollback() to unwind the transaction, which is
useful for writing test cases.
0.2.0
+ sqlh.Scanner.Select handles "no rows" for dest *T where T is a struct by setting
the *T to nil.
0.1.0
+ Breaking change migration (impact=low).
Interface sqlh.IRows renamed to sqlh.IIterates.
+ Add packages examples, grammar, model, & schema.
+ examples exports some utility to facilitate our example code.
+ grammar, model, and schema work together to provide a simple `model`
layer to cut down on boiler plate for `INSERT|UPDATE` operations
on Go types representing database tables.
+ sqlh.Scanner.Select can now scan the following types of results:
+ T where T is a scalar or primitive value.
+ []T where T is a scalar or primitive value.
+ T where T is a single struct.
+ []T where T is a struct slice.
+ Add interfaces sqlh.IBegins and sqlh.IPrepares.
0.0.2
+ No API change; clean up some documentation.
0.0.1
+ Add interfaces:
+ IQuery - A type that can run a database query.
+ IRows - A type that can iterate a database result set.
+ Add type:
+ Scanner - The powerhouse of the package.