Skip to content

Commit

Permalink
fix(scheme): clob兼容mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
maowei committed Feb 1, 2023
1 parent 52d4cfa commit 6e8a1ff
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions schema/clob.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package dmSchema

import (
"database/sql/driver"
"errors"
"fmt"

"github.com/nfjBill/gorm-driver-dm/dmr"
)

Expand All @@ -23,13 +21,14 @@ func (clob *Clob) Scan(v interface{}) error {
tmp := v.(*dmr.DmClob)
le, err := tmp.GetLength()
if err != nil {
return errors.New(fmt.Sprint("err:", err))
return fmt.Errorf("err:%w", err)
}

str, err := tmp.ReadString(1, int(le))
*clob = Clob(str)
break

case []uint8:
*clob = Clob(v.([]uint8))
default:
*clob = Clob(v.(string))
}
Expand Down

0 comments on commit 6e8a1ff

Please sign in to comment.