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 sqlite
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
)
|
||||
|
|
@ -23,7 +24,8 @@ func newDialect() jet.Dialect {
|
|||
ArgumentPlaceholder: func(int) string {
|
||||
return "?"
|
||||
},
|
||||
ReservedWords: reservedWords2,
|
||||
ArgumentToString: argumentToString,
|
||||
ReservedWords: reservedWords2,
|
||||
ValuesDefaultColumnName: func(index int) string {
|
||||
return fmt.Sprintf("column%d", index+1)
|
||||
},
|
||||
|
|
@ -32,6 +34,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 sqliteBitXOR(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