gf icon indicating copy to clipboard operation
gf copied to clipboard

gf gen dao: issue title gf gen dao的 时候 映射vector向量类型映射[]float64存入数据库报错

Open sxp20008 opened this issue 3 months ago • 1 comments

Go version

1.25

GoFrame version

2.9.0

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

gf gen dao的 时候 映射vector向量类型的时候我映射的是:
vector: type: "[]float64" 但在存入的pgsql的pgvector会报错

What did you see happen?

  1. pq: invalid input syntax for type vector: "{-0.4609375,0.6953125,0.6953125,-0.443359375,-0.20703125,-0.02490234

What did you expect to see?

解决报错

sxp20008 avatar Oct 02 '25 14:10 sxp20008

向量类型并不是标准SQL里支持的类型,应该为向量类型映射为专门类型。

  • 你可以自己创建类型,然后为其实现 sql.Scansql/driver.Value 方法。
  • 或使用第三方库:pgvector-go

wufeng5702 avatar Oct 11 '25 08:10 wufeng5702