Skip to content

Commit

Permalink
fix: log model values everywhere (#656)
Browse files Browse the repository at this point in the history
Some SQL logs were missing the values as argument. This adds all places
  • Loading branch information
zepatrik committed Jun 28, 2021
1 parent bb07a37 commit d279000
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dialect_cockroach.go
Expand Up @@ -81,7 +81,7 @@ func (p *cockroach) Create(s store, model *Model, cols columns.Columns) error {
} else {
query = fmt.Sprintf("INSERT INTO %s DEFAULT VALUES returning %s", p.Quote(model.TableName()), model.IDField())
}
log(logging.SQL, query)
log(logging.SQL, query, model.Value)
stmt, err := s.PrepareNamed(query)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions dialect_common.go
Expand Up @@ -53,7 +53,7 @@ func genericCreate(s store, model *Model, cols columns.Columns, quoter quotable)
cols.Remove(model.IDField())
w := cols.Writeable()
query := fmt.Sprintf("INSERT INTO %s (%s) VALUES (%s)", quoter.Quote(model.TableName()), w.QuotedString(quoter), w.SymbolizedString())
log(logging.SQL, query)
log(logging.SQL, query, model.Value)
res, err := s.NamedExec(query, model.Value)
if err != nil {
return err
Expand Down Expand Up @@ -81,7 +81,7 @@ func genericCreate(s store, model *Model, cols columns.Columns, quoter quotable)
w := cols.Writeable()
w.Add(model.IDField())
query := fmt.Sprintf("INSERT INTO %s (%s) VALUES (%s)", quoter.Quote(model.TableName()), w.QuotedString(quoter), w.SymbolizedString())
log(logging.SQL, query)
log(logging.SQL, query, model.Value)
stmt, err := s.PrepareNamed(query)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion dialect_postgresql.go
Expand Up @@ -68,7 +68,7 @@ func (p *postgresql) Create(s store, model *Model, cols columns.Columns) error {
} else {
query = fmt.Sprintf("INSERT INTO %s DEFAULT VALUES returning %s", p.Quote(model.TableName()), model.IDField())
}
log(logging.SQL, query)
log(logging.SQL, query, model.Value)
stmt, err := s.PrepareNamed(query)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion dialect_sqlite.go
Expand Up @@ -82,7 +82,7 @@ func (m *sqlite) Create(s store, model *Model, cols columns.Columns) error {
} else {
query = fmt.Sprintf("INSERT INTO %s DEFAULT VALUES", m.Quote(model.TableName()))
}
log(logging.SQL, query)
log(logging.SQL, query, model.Value)
res, err := s.NamedExec(query, model.Value)
if err != nil {
return err
Expand Down

0 comments on commit d279000

Please sign in to comment.