gorm
gorm copied to clipboard
the output of .Debug() for UUID binary(16)
Your Question
I use MySql binary(16) to store UUID generated from google uuid pkg. When under '.Debug()' mode, like db.Debug().Create()... on the output of SQL statement, some uuid will be output as '
Expected answer
I cannot reproduce your situation. Could you plz provide your code?
I tried to reproduce (but use sqlite) and the UUID is output correctly.
package main
import (
"github.com/google/uuid"
"github.com/tzq0301/gorms"
)
type User struct {
ID uuid.UUID
}
func main() {
db, _ := gorms.InMemorySqliteWithInitSQL(`
CREATE TABLE users (
id BINARY(16)
);
`)
id, _ := uuid.NewUUID()
db.Debug().Create(&User{ID: id})
}
// Output in console:
// [0.180ms] [rows:1] INSERT INTO `users` (`id`) VALUES ("f6b07a8a-a79e-11ed-80ca-acde48001122")
This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days