Add support for blob expressions.
This commit is contained in:
parent
26e478dc7e
commit
c94216ab0e
37 changed files with 1296 additions and 81 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
)
|
||||
|
|
@ -27,6 +28,7 @@ func newDialect() jet.Dialect {
|
|||
ArgumentPlaceholder: func(int) string {
|
||||
return "?"
|
||||
},
|
||||
ArgumentToString: argumentToString,
|
||||
ReservedWords: reservedWords,
|
||||
SerializeOrderBy: serializeOrderBy,
|
||||
ValuesDefaultColumnName: func(index int) string {
|
||||
|
|
@ -37,6 +39,15 @@ func newDialect() jet.Dialect {
|
|||
return jet.NewDialect(mySQLDialectParams)
|
||||
}
|
||||
|
||||
func argumentToString(value any) (string, bool) {
|
||||
switch bindVal := value.(type) {
|
||||
case []byte:
|
||||
return fmt.Sprintf("X'%s'", hex.EncodeToString(bindVal)), true
|
||||
}
|
||||
|
||||
return "", false
|
||||
}
|
||||
|
||||
func mysqlBitXor(expressions ...jet.Serializer) jet.SerializerFunc {
|
||||
return func(statement jet.StatementType, out *jet.SQLBuilder, options ...jet.SerializeOption) {
|
||||
if len(expressions) < 2 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue