Skip to content

Commit 6b412f9

Browse files
authored
Merge pull request #9 from alehechka/feature/add-timeformat-default
Add DefaultTimeFormat constant
2 parents 19cf20b + 829a82c commit 6b412f9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

gen/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"log"
66
"path/filepath"
77
"strings"
8-
"time"
98

109
"github.com/alehechka/json2go/jenshared"
1110
"github.com/alehechka/json2go/utils"
@@ -66,5 +65,5 @@ func (c *Config) prepareOutputFileName() {
6665
}
6766

6867
func (c *Config) getTimeFormat() string {
69-
return utils.GetTimeFormat(c.TimeFormat, time.RFC3339)
68+
return utils.GetTimeFormat(c.TimeFormat, utils.TimeFormatMap[DefaultTimeFormat])
7069
}

gen/constants.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package gen
22

33
// DefaultOutputFile is the name of the default output file
4-
const DefaultOutputFile = "types.go"
4+
const DefaultOutputFile string = "types.go"
55

66
// DefaultPackage is the name of the default package
7-
const DefaultPackage = "main"
7+
const DefaultPackage string = "main"
88

99
// DefaultRootName is the default name of the top-level JSON object
10-
const DefaultRootName = "Root"
10+
const DefaultRootName string = "Root"
11+
12+
// DefaultTimeFormat is the default time format to parse with.
13+
const DefaultTimeFormat string = "RFC3339"

0 commit comments

Comments
 (0)