Commit Graph

42 Commits

Author SHA1 Message Date
emacsist
cadc8ad72d add "yyyy-MM-dd HH:mm:ss" string format > time.Time
I notice that the Hugo use this project to convert the string to time.Time.
When I migrate to Hugo from Hexo (another static blog generator). The Hugo said :

> page.go:750: Failed to parse date '2016-03-06 15:28:01' in page xxxxx.md

I hope you can merge this Pull request, so that those people who migrate to Hugo from Hexo are easy to use Hugo to generate the static blog.

Thanks.
2016-11-12 02:01:40 +08:00
Bjørn Erik Pedersen
2580bc98dc 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
7c3adfba29 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@
60e7a69a42 Add ToBoolSlice()
Fixes #1
2016-09-19 22:26:41 +02:00
Chih-Hung Yeh
fa673d63c1 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
4532b05430 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
e31f36ffc9 Log the To* invocations as TRACE
It gets very chatty at DEBUG.
2016-07-30 11:20:37 +02:00
Bjørn Erik Pedersen
27b586b42e Add support for the other html template types 2016-03-14 20:20:28 +01:00
Matt Keller
0eed3d1b35 Add a ToInt64() and necessary plumbing 2016-03-14 20:19:19 +01:00
Matt Keller
7c7add0129 Add ability to cast int64's to strings
Resolves #18
2016-03-14 20:18:57 +01:00
Cyrill Schumacher
ee7b3e0353 Add bool case to ToStringE 2015-12-18 08:52:19 -05:00
Tyler Power
6770a32f65 Add int64 and float64 type coercion in ToDuration 2015-11-23 09:21:13 +13:00
Jeff Hodges
ee815aaf95 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
1c4ba956f5 adding back default statements and adding comments and cleanups 2015-08-03 12:36:12 -04:00
jackspirou
d7ba796a5f adding unit tests for ToStringMapString and ToStringMapStringSlice methods 2015-08-03 12:36:12 -04:00
jackspirou
7ed57e5c41 adding ToStringMapStringSlice method 2015-08-03 12:36:12 -04:00
bep
893a4154d1 Add support for template.URL
Fixes #13
2015-08-03 12:35:39 -04:00
bep
4d07383ffe 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
2c4fdb5416 Add ToIntSlice 2015-02-24 12:08:11 -05:00
Chance Zibolski
3cc9db95ac Add ToDuration 2015-02-24 12:07:25 -05:00
Chance Zibolski
dace11d497 Use strings.Fields 2015-02-24 12:06:34 -05:00
Chance Zibolski
b24b4ff690 ToStringSliceE: Support string values 2015-02-24 12:06:34 -05:00
spf13
2318c5caf2 Add support for pointers to basic types 2015-01-01 00:23:46 -05:00
spf13
421411cf35 Add proper support for error -> string and Stringer -> string. 2015-01-01 00:18:13 -05:00
Derek Perkins
c0388c79a0 Defaulted .ToStringE to use reflection to find a stringer element 2014-12-18 22:44:40 -05:00
bep
0a58809502 Add support for HTML to String 2014-12-09 09:02:27 -05:00
Steve Francia
312ed27bce 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
fb4a45a374 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
ed6dd5ade6
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
spf13
99f1223ff6 Adding ToSlice 2014-04-26 16:56:25 -06:00
spf13
d578378de0 Caste now returns error instead of bool. 2014-04-24 10:21:33 -06:00
spf13
b252e9f21d Handling another case (map[string]interface{}) 2014-04-07 22:40:49 -04:00
spf13
5a9b0d4cc3 adding Int to Float. Testing for float 2014-04-07 11:48:02 -04:00
spf13
d6ad1120de Handling complex cases where input matches expected output 2014-04-07 11:42:50 -04:00
spf13
559d57776b Writing the README. Handling a few more cases, adding more tests. 2014-04-05 15:18:23 -04:00
spf13
6796452c69 initial commit of library & tests 2014-04-05 01:21:52 -04:00
Steve Francia
0c4ca4142d Initial commit 2014-04-03 11:21:16 -07:00