My struct has a memeber of mssql.UniqueIdentifier type.

type Demo struct{ ID mssql.UniqueIdentifier }

The output of sql logs, you will see something like this: '\<binary>' or '������UC��A��Y�C'

I check the code: 1) mssql.UniqueIdentifier type has methods: func (u UniqueIdentifier) Value() (driver.Value, error) for driver.Valuer interface of sql package. func (u UniqueIdentifier) String() string for fmt.Stringer interface.

2) In gorm logger/sql.go line: 34 Method ExplainSQL, it will match type driver.Valuer (line: 60) first, then got the internal type []byte, and match []byte again, so it will be dispaly as '\<binary>' or gabled codes.

I think if we're match fmt.Stringer before driver.Valuer, it can correctly dispaly UUID.
But i'am not sure whether this change will had bad impact on other types.

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: Emptyless

A simple mitigation if logging is necessary is to wrap the mssql.UniqueIdentifier in a custom struct with Scan/Value methods implemented (e.g. type SomeName string) which calls the underlying mssql.UniqueIdentifier Scan method for scanning and cast to string (in my example) for the Value method.

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking