Merge remote-tracking branch 'upstream/master' into stmt-cache
This commit is contained in:
commit
adfa331ece
21 changed files with 218 additions and 54 deletions
|
|
@ -2,6 +2,7 @@ package postgres
|
|||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/utils/is"
|
||||
)
|
||||
|
||||
type onConflict interface {
|
||||
|
|
@ -44,7 +45,7 @@ func (o *onConflictClause) DO_UPDATE(action conflictAction) InsertStatement {
|
|||
}
|
||||
|
||||
func (o *onConflictClause) Serialize(statementType jet.StatementType, out *jet.SQLBuilder, options ...jet.SerializeOption) {
|
||||
if len(o.indexExpressions) == 0 && o.constraint == "" {
|
||||
if is.Nil(o.do) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ func TestOnConflict(t *testing.T) {
|
|||
|
||||
onConflict := &onConflictClause{}
|
||||
onConflict.DO_NOTHING()
|
||||
assertClauseSerialize(t, onConflict, "")
|
||||
assertClauseSerialize(t, onConflict, `
|
||||
ON CONFLICT DO NOTHING`)
|
||||
|
||||
onConflict = &onConflictClause{indexExpressions: ColumnList{table1ColBool}}
|
||||
onConflict.DO_NOTHING()
|
||||
|
|
|
|||
|
|
@ -111,6 +111,12 @@ var (
|
|||
TstzRangeExp = jet.TstzRangeExp
|
||||
)
|
||||
|
||||
// CustomExpression is used to define custom expressions.
|
||||
var CustomExpression = jet.CustomExpression
|
||||
|
||||
// Token is used to define custom token in a custom expression.
|
||||
type Token = jet.Token
|
||||
|
||||
// RawArgs is type used to pass optional arguments to Raw method
|
||||
type RawArgs = map[string]interface{}
|
||||
|
||||
|
|
@ -142,3 +148,6 @@ var Func = jet.Func
|
|||
|
||||
// NewEnumValue creates new named enum value
|
||||
var NewEnumValue = jet.NewEnumValue
|
||||
|
||||
// BinaryOperator can be used to use custom or unsupported operators that take two operands.
|
||||
var BinaryOperator = jet.BinaryOperator
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue