Skip to content

added created by and updated by in model stub #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/generate/cmd.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package generate

import (
"log"

"github.com/spf13/afero"
"github.com/spf13/cobra"
"log"
)

var MakeCommand = &cobra.Command{
Expand Down
7 changes: 4 additions & 3 deletions cmd/generate/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package generate

import (
"fmt"
pluralize "github.com/gertd/go-pluralize"
"github.com/spf13/afero"
"github.com/spf13/cobra"
"log"
"path"
"runtime"
"strings"

pluralize "github.com/gertd/go-pluralize"
"github.com/spf13/afero"
"github.com/spf13/cobra"
)

var PackageName string
Expand Down
2 changes: 2 additions & 0 deletions cmd/generate/stubs/model.stub
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ type {{TitleName}} struct {
Id primitive.ObjectID `json:"id,omitempty" bson:"_id"`
Task string `json:"task" bson:"task"`
Status string `json:"status" bson:"status"`
CreatedBy string `json:"created_by,omitempty" bson:"created_by"`
CreatedAt time.Time `json:"created_at,omitempty" bson:"created_at"`
UpdatedBy string `json:"updated_by,omitempty" bson:"updated_by"`
UpdatedAt time.Time `json:"updated_at,omitempty" bson:"updated_at"`
}

Expand Down
3 changes: 2 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cmd

import (
"log"

"github.com/shipu/artifact/cmd/generate"
"github.com/spf13/cobra"
"log"
)

var RootCmd = &cobra.Command{
Expand Down