Skip to content

Commit

Permalink
Merge pull request #9 from alehechka/feature/add-timeformat-default
Browse files Browse the repository at this point in the history
Add DefaultTimeFormat constant
  • Loading branch information
alehechka authored Jul 1, 2022
2 parents 19cf20b + 829a82c commit 6b412f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions gen/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"log"
"path/filepath"
"strings"
"time"

"github.com/alehechka/json2go/jenshared"
"github.com/alehechka/json2go/utils"
Expand Down Expand Up @@ -66,5 +65,5 @@ func (c *Config) prepareOutputFileName() {
}

func (c *Config) getTimeFormat() string {
return utils.GetTimeFormat(c.TimeFormat, time.RFC3339)
return utils.GetTimeFormat(c.TimeFormat, utils.TimeFormatMap[DefaultTimeFormat])
}
9 changes: 6 additions & 3 deletions gen/constants.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package gen

// DefaultOutputFile is the name of the default output file
const DefaultOutputFile = "types.go"
const DefaultOutputFile string = "types.go"

// DefaultPackage is the name of the default package
const DefaultPackage = "main"
const DefaultPackage string = "main"

// DefaultRootName is the default name of the top-level JSON object
const DefaultRootName = "Root"
const DefaultRootName string = "Root"

// DefaultTimeFormat is the default time format to parse with.
const DefaultTimeFormat string = "RFC3339"

0 comments on commit 6b412f9

Please sign in to comment.