Skip to content

Commit

Permalink
update odm Template
Browse files Browse the repository at this point in the history
  • Loading branch information
czyt committed Jan 12, 2023
1 parent 3481777 commit 42077a8
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type {{.ModelNameLowCase}}DataRepo struct {
}

func ({{.ModelIdentifier}} {{.ModelNameLowCase}}DataRepo) CreateOne{{.ModelName}}(ctx context.Context, data *{{.BizPkg}}.{{.ModelName}}, opts ...*options.InsertOneOptions) (result *mongo.InsertOneResult, err error) {
if data.CreatedAt.IsZero() {
data.CreatedAt = time.Now()
}
return mgm.Coll({{.ModelIdentifier}}.model).InsertOne(ctx, data, opts...)
}

Expand Down

0 comments on commit 42077a8

Please sign in to comment.