Releases: vitaly-t/pg-promise
v.0.8.0
Adding support for named-parameter formatting, using ES6-like syntax of ${varName}
.
See added chapter Named Parameters for all the details.
Another significant change - restructuring the package into two files, moving both files into sub-folder \lib
Many tests were amended and new ones added to allow for the changes.
v.0.7.1
After a careful consideration of some of the last changes, it was decided that supporting parameter se
(Suppress Errors) in method as.format
was completely unnecessary. Throwing it away has allowed significant simplification in the logic of query formatting and test cases. It was one "feature" really worth throwing away.
As the result of the change:
- refactored query formatting to about half the size, it is now very nice and simple;
- threw away many extra tests caused by the previous complexity of the parameter formatting;
- updated documentation (simplified also).
v.0.7.0
This release brings in one small breaking change in the way method as.format
works. It was originally designed for internal usage, and was returning an object with the formatted result, which made it different from the rest of the methods in the pgp.as
namespace.
The new implementation changes it so it would return the formatted text string, when successful or throw an error when fails, to make it consistent with the rest of the API. And in order to keep it compatible with the internal logic, it now takes the third parameter se
(suppress errors) to return an object as before. See the updated chapter Conversion Helpers for details.
All related tests were reorganized and extended to cater for this new logic.
Other changes include:
- Documentation updates, such as - added a new example of using formatting methods;
- Code refactoring;
- New tests added;
v.0.6.5
v.0.6.4
- code documentation and refactoring;
- error text improvements;
- added support for Dependencies icon on the main page;
- switched all tests from using Promise to Bluebird, because I needed to use Promise.any([])
- added a few new tests;
- made package dependencies less strict;
- docs updates;
Many commits relate to my attempt of incorporating automated coverage, which I got working locally, showing 90% coverage, but after long hours spent I couldn't get it to work automatically with coverall.ie, so all changes related to that were yanked out. Perhaps it will be done later, and in another branch, to avoid messing with the master branch again. And if anyone wants to help me with that - please, make a fork for it.
v.0.6.3
This release is just about ongoing improvements, without affecting functionality:
- code documentation and refactoring
- adding tests for better coverage
There was only one very minor code change - removing ';' in the end of generated function-call queries, because it is completely unnecessary there.
v.0.6.2
This release signifies no changes to the implementation as such, but massive changes to the tests and overall documentation.
It is the first release that includes a complete database test suit (as complete as it can be). Considering that generic access to the database can hardly be fully covered, only the most interesting cases were included in the tests.
Further addition of tests will be done based on feedback and/or any issues reported.
v.0.6.1
Changing as.csv()
output to be consistent with that when formatting a function call, which means for one thing - supporting a single value, not just an array of values.
Tests have been updated extensively to consider every single situation:
it("must correctly convert any Array of values into CSV", function () {
expect(pgp.as.csv()).toBe(""); // test undefined;
expect(pgp.as.csv([])).toBe(""); // test empty array;
expect(pgp.as.csv(null)).toBe("null"); // test null;
expect(pgp.as.csv([null])).toBe("null"); // test null in array;
expect(pgp.as.csv([undefined])).toBe("null"); // test undefined in array;
expect(pgp.as.csv([null, undefined])).toBe("null,null"); // test combination of null + undefined in array;
expect(pgp.as.csv(0)).toBe("0"); // test zero;
expect(pgp.as.csv([0])).toBe("0"); // test zero in array;
expect(pgp.as.csv(-123.456)).toBe("-123.456"); // test a float;
expect(pgp.as.csv([-123.456])).toBe("-123.456"); // test a float in array;
expect(pgp.as.csv(true)).toBe("TRUE"); // test boolean True;
expect(pgp.as.csv([true])).toBe("TRUE"); // test boolean True in array;
expect(pgp.as.csv(false)).toBe("FALSE"); // test boolean False;
expect(pgp.as.csv([false])).toBe("FALSE"); // test boolean False in array;
expect(pgp.as.csv("")).toBe("''"); // empty text;
expect(pgp.as.csv([""])).toBe("''"); // empty text in array;
expect(pgp.as.csv("simple text")).toBe("'simple text'"); // simple text;
expect(pgp.as.csv("don't break")).toBe("'don''t break'"); // text with one single-quote symbol;
expect(pgp.as.csv("test ''")).toBe("'test '''''"); // text with two single-quote symbols;
expect(pgp.as.csv(new Date(2015, 2, 8, 16, 24, 8))).toBe("'Sun, 08 Mar 2015 16:24:08 GMT'"); // test date;
expect(pgp.as.csv([new Date(2015, 2, 8, 16, 24, 8)])).toBe("'Sun, 08 Mar 2015 16:24:08 GMT'"); // test date in array;
// test a combination of all values types;
expect(pgp.as.csv([12.34, true, "don't break", undefined, new Date(2015, 2, 8, 16, 24, 8)]))
.toBe("12.34,TRUE,'don''t break',null,'Sun, 08 Mar 2015 16:24:08 GMT'");
});
Minor code refactoring and documentation updates were made also.
v.0.6.0
Another set of changes to finalize the special formatting case when null
is passed, this time for function calls.
Calling db.func('name', null)
was supposed to produce the same function signature of name(null)
as when calling db.func('name', [null])
, but instead it was generating name()
, which was wrong. This is now fixed.
It is worth pointing that while calling db.func('name')
is the same as calling db.func('name', [])
, it is not the same as calling db.func('name', [undefined])
, because undefined
within an array of parameters is always treated the same as null
.
Other code clean up and refactoring was done to better separate null
from undefined
when it comes to parameter formatting.
Even though in very few cases, this does affect the formatting behaviour, that's why the version was upped to 0.6.0.
Some documentation improvements were made, including an example of dealing with binary data types.
v.0.5.9
- Fixes a discrepancy in query formatting for one specific case:
format("$1", null)
was supposed to produce the same result"null"
as when callingformat("$1", [null])
, but it didn't, and the test against it was wrong either. Tests were updated to cover this case properly. - Minor code refactoring + documentation updates.