Skip to content

Commit

Permalink
Merge pull request #167 from d-tsuji/master
Browse files Browse the repository at this point in the history
#10 do not import github.com/guregu/null, when there is no --guregu option
  • Loading branch information
smallnest authored Jul 12, 2021
2 parents ce87ebf + 13084ff commit dcfa6a9
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 86 deletions.
2 changes: 2 additions & 0 deletions dbmeta/codegen.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ func (c *Config) WriteTemplate(genTemplate *GenTemplate, data map[string]interfa
data["daoFQPN"] = c.DaoFQPN
data["daoPackageName"] = c.DaoPackageName

data["UseGuregu"] = c.UseGureguTypes

data["apiFQPN"] = c.APIFQPN
data["apiPackageName"] = c.APIPackageName

Expand Down
160 changes: 80 additions & 80 deletions packrd/packed-packr.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion template/api.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"{{.daoFQPN}}"

"github.com/gin-gonic/gin"
"github.com/guregu/null"
{{if .UseGuregu}} "github.com/guregu/null" {{end}}
"github.com/julienschmidt/httprouter"
)

Expand Down
4 changes: 2 additions & 2 deletions template/dao_gorm.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (

"{{.modelFQPN}}"

"github.com/guregu/null"
{{if .UseGuregu}} "github.com/guregu/null" {{end}}
"github.com/satori/go.uuid"
)

var (
_ = time.Second
_ = null.Bool{}
{{if .UseGuregu}} _ = null.Bool{} {{end}}
_ = uuid.UUID{}
)

Expand Down
4 changes: 2 additions & 2 deletions template/dao_sqlx.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (

"{{.modelFQPN}}"

"github.com/guregu/null"
{{if .UseGuregu}} "github.com/guregu/null" {{end}}
"github.com/satori/go.uuid"
)

var (
_ = time.Second
_ = null.Bool{}
{{if .UseGuregu}} _ = null.Bool{} {{end}}
_ = uuid.UUID{}
)

Expand Down
2 changes: 1 addition & 1 deletion template/model.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/satori/go.uuid"
"github.com/guregu/null"
{{if .UseGuregu}} "github.com/guregu/null" {{end}}
"gorm.io/gorm"
)

Expand Down

0 comments on commit dcfa6a9

Please sign in to comment.