Use table expr when inserting table
This commit is contained in:
parent
da1e54d5ab
commit
a1e492244f
@ -43,9 +43,7 @@ func Create(config *Config) func(db *gorm.DB) {
|
|||||||
|
|
||||||
if db.Statement.SQL.String() == "" {
|
if db.Statement.SQL.String() == "" {
|
||||||
db.Statement.SQL.Grow(180)
|
db.Statement.SQL.Grow(180)
|
||||||
db.Statement.AddClauseIfNotExists(clause.Insert{
|
db.Statement.AddClauseIfNotExists(clause.Insert{})
|
||||||
Table: clause.Table{Name: db.Statement.Table},
|
|
||||||
})
|
|
||||||
db.Statement.AddClause(ConvertToCreateValues(db.Statement))
|
db.Statement.AddClause(ConvertToCreateValues(db.Statement))
|
||||||
|
|
||||||
db.Statement.Build("INSERT", "VALUES", "ON CONFLICT")
|
db.Statement.Build("INSERT", "VALUES", "ON CONFLICT")
|
||||||
@ -105,9 +103,7 @@ func CreateWithReturning(db *gorm.DB) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if db.Statement.SQL.String() == "" {
|
if db.Statement.SQL.String() == "" {
|
||||||
db.Statement.AddClauseIfNotExists(clause.Insert{
|
db.Statement.AddClauseIfNotExists(clause.Insert{})
|
||||||
Table: clause.Table{Name: db.Statement.Table},
|
|
||||||
})
|
|
||||||
db.Statement.AddClause(ConvertToCreateValues(db.Statement))
|
db.Statement.AddClause(ConvertToCreateValues(db.Statement))
|
||||||
|
|
||||||
db.Statement.Build("INSERT", "VALUES", "ON CONFLICT")
|
db.Statement.Build("INSERT", "VALUES", "ON CONFLICT")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user