Commit Graph

58 Commits

Author SHA1 Message Date
Cameron Moore
7684a086b8 Add Travis CI 2017-03-04 12:22:48 +01:00
Cameron Moore
06c9b5699b Small simplifications 2017-03-04 12:22:30 +01:00
Cameron Moore
35f6a2067b Use single defined error for negatives 2017-03-03 22:17:07 +01:00
Cameron Moore
ec00522bf1 Error on unsigned conversions of negative values 2017-03-03 22:17:07 +01:00
Cameron Moore
d494984176 Add additional type conversions
Adds float32, uint, uint64, uint32, uint16, and uint8 throughout.

Fixes #33
2017-03-03 22:17:07 +01:00
Cameron Moore
1d8f84c7ba Refactor tests to get full coverage
Test coverage goes from 75.6% to 100%
2017-03-03 19:55:50 +01:00
Cameron Moore
0971e2bbf7 Update and standardize error messages 2017-03-03 18:07:04 +01:00
Cameron Moore
b06778b83d Fix issues found by gosimple 2017-03-03 17:34:16 +01:00
Cameron Moore
23a5d4bdbf Update godoc comments 2017-03-03 16:45:07 +01:00
Cameron Moore
af08674106 Fix gofmt and golint errors 2017-03-03 16:44:53 +01:00
Cameron Moore
2c1736b7b7 Add godoc and report card badges to README 2017-03-03 15:55:07 +01:00
Cameron Moore
c460d7f4c5 Add Makefile 2017-03-03 15:54:19 +01:00
chyeh
26aa51ce9f Add ToInt8, ToInt16 and ToInt32 2017-03-03 15:54:08 +01:00
Cameron Moore
2eebd0e3c5 Fix regression in StringToDate
In commit d1139ba, I removed a date format for "RFC3339 without T" that
I misidentified as a reduntant format.  This commit adds it back with a
test.
2017-02-21 16:23:02 +01:00
Cameron Moore
e5bb6e5a36 Add missing time formats and tests
Add missing time formats, remove duplicate formats, and test all
supported formats.
2017-01-28 19:09:31 +07:00
Cameron Moore
787d9daf73 Add Unix epoch support to ToTimeE 2016-12-25 13:56:48 +01:00
emacsist
641ebec6b1 Add "yyyy-MM-dd HH:mm:ss" string format 2016-11-16 02:33:54 +01:00
Bjørn Erik Pedersen
0c3f14c4f5 Remove expensive TRACE logging
```
benchmark              old ns/op     new ns/op     delta
BenchmarkTooBool-4     2671          67.8          -97.46%

benchmark              old allocs     new allocs     delta
BenchmarkTooBool-4     3              1              -66.67%

benchmark              old bytes     new bytes     delta
BenchmarkTooBool-4     49            1             -97.96%
```
2016-09-26 10:42:49 +02:00
Bjørn Erik Pedersen
793d04edb9 Add benchmark for ToBool
```
BenchmarkTooBool-4   	  500000	      2781 ns/op	      49 B/op	       3 allocs/op
```
2016-09-26 10:25:08 +02:00
M@
f5e28046c2 Add ToBoolSlice()
Fixes #1
2016-09-19 22:26:41 +02:00
Chih-Hung Yeh
d6087e9fee Fixe ToDurationE()
It used to return zero valeus in some cases. The details are described
in [this issue](https://github.com/spf13/viper/issues/203). More cases
were also added in the unit test `TestToDuration()`
2016-09-19 22:24:24 +02:00
Feng
d0332e9ed2 FIx ToStringMapStringSliceE
* Update caste.go

bug fix

json config, for example:
{ "test" : ["abc", "123"] }

* update test
2016-09-19 22:22:46 +02:00
Bjørn Erik Pedersen
8b56e258db Log the To* invocations as TRACE
It gets very chatty at DEBUG.
2016-07-30 11:20:37 +02:00
Bjørn Erik Pedersen
3aaefdbf6a Add support for the other html template types 2016-03-14 20:20:28 +01:00
Matt Keller
9715267734 Add a ToInt64() and necessary plumbing 2016-03-14 20:19:19 +01:00
Matt Keller
a1423fc5cb Add ability to cast int64's to strings
Resolves #18
2016-03-14 20:18:57 +01:00
Cyrill Schumacher
231a396cd1 Add bool case to ToStringE 2015-12-18 08:52:19 -05:00
Tyler Power
865ef5b570 Add int64 and float64 type coercion in ToDuration 2015-11-23 09:21:13 +13:00
Jeff Hodges
c90f69802d add date formats found in jekyll posts
The first added is definitely in jekyll. The second, I believe, happens,
too.
2015-08-03 12:37:15 -04:00
jackspirou
7f89bd90d6 adding back default statements and adding comments and cleanups 2015-08-03 12:36:12 -04:00
jackspirou
5c45f385d3 adding unit tests for ToStringMapString and ToStringMapStringSlice methods 2015-08-03 12:36:12 -04:00
jackspirou
f470482ee6 adding ToStringMapStringSlice method 2015-08-03 12:36:12 -04:00
bep
630f70c55b Add support for template.URL
Fixes #13
2015-08-03 12:35:39 -04:00
bep
d5fbab11ba Make ToIntSliceE more flexible
Now it accepts any slice or array type that contains a type supported by ToIntE.

[close #12]
2015-05-08 15:17:42 -04:00
bep
aa9165b0a4 Add ToIntSlice 2015-02-24 12:08:11 -05:00
Chance Zibolski
638abf0962 Add ToDuration 2015-02-24 12:07:25 -05:00
Chance Zibolski
212d45479b Use strings.Fields 2015-02-24 12:06:34 -05:00
Chance Zibolski
5529b218a4 ToStringSliceE: Support string values 2015-02-24 12:06:34 -05:00
spf13
9590eb1aa4 Add support for pointers to basic types 2015-01-01 00:23:46 -05:00
spf13
0c3b98469e Add proper support for error -> string and Stringer -> string. 2015-01-01 00:18:13 -05:00
Derek Perkins
8dde8855a1 Defaulted .ToStringE to use reflection to find a stringer element 2014-12-18 22:44:40 -05:00
bep
0f53950475 Add support for HTML to String 2014-12-09 09:02:27 -05:00
Steve Francia
6776c50132 Merge pull request #6 from txgruppi/readme-update
Updated README, it was describing the wrong return type
2014-12-03 08:50:30 +01:00
Steve Francia
5a39e85915 Merge pull request #5 from txgruppi/master
Updated to return bool false only for zero
2014-12-03 08:50:16 +01:00
Steve Francia
c8f8b1be37 Merge pull request #4 from bjornerik/tostringmapbool 2014-12-03 08:47:58 +01:00
txgruppi
81040b7566 Updated README, it was describing the wrong return type 2014-11-19 18:23:47 +00:00
txgruppi
5f1493bbb7 Updated to return bool false only for zero 2014-11-19 18:08:49 +00:00
bep
bbe2d4b35d Add ToStringMapBool
ToStringMapBool is useful for a map of flags in a configuration file.
2014-11-06 11:32:02 +01:00
Asdine El Hrychy
770890fb15 Removed forgotten fmt.Println("here") 2014-09-08 12:16:11 -04:00
Romain Baugue
075c75a269 Added ToBool case for string, and added ToBool test cases 2014-09-08 12:15:23 -04:00