Merge pull request #325 from realbucksavage/master
mysql: added a helper to compare UUID strings with uuid_to_bin
This commit is contained in:
commit
a9cbf94d68
3 changed files with 19 additions and 1 deletions
|
|
@ -222,6 +222,12 @@ var SUBSTR = jet.SUBSTR
|
|||
// REGEXP_LIKE Returns 1 if the string expr matches the regular expression specified by the pattern pat, 0 otherwise.
|
||||
var REGEXP_LIKE = jet.REGEXP_LIKE
|
||||
|
||||
// UUID_TO_BIN is a helper function that calls "uuid_to_bin" function on the passed value.
|
||||
func UUID_TO_BIN(str StringExpression) StringExpression {
|
||||
fn := Func("uuid_to_bin", str)
|
||||
return StringExp(fn)
|
||||
}
|
||||
|
||||
//----------------- Date/Time Functions and Operators ------------//
|
||||
|
||||
// EXTRACT function retrieves subfields such as year or hour from date/time values
|
||||
|
|
|
|||
11
mysql/functions_test.go
Normal file
11
mysql/functions_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func TestUUIDToBin(t *testing.T) {
|
||||
assertSerialize(t, UUID_TO_BIN(String(uuid.Nil.String())), `uuid_to_bin(?)`, uuid.Nil.String())
|
||||
}
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"time"
|
||||
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
)
|
||||
|
||||
// Keywords
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue