add workaround for package gdb for json infinite loop bug of Golang version < v1.14

This commit is contained in:
John
2020-03-08 11:56:19 +08:00
parent 8e40cded42
commit c444630d1e

View File

@ -699,6 +699,15 @@ func (c *Core) rowsToResult(rows *sql.Rows) (Result, error) {
return records, nil
}
// MarshalJSON implements the interface MarshalJSON for json.Marshal.
// It just returns the pointer address.
//
// Note that this interface implements mainly for workaround for a json infinite loop bug
// of Golang version < v1.14.
func (c *Core) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`%+v`, c)), nil
}
// writeSqlToLogger outputs the sql object to logger.
// It is enabled when configuration "debug" is true.
func (c *Core) writeSqlToLogger(v *Sql) {