We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempting to use a net.IP field in a gorm model causes a sqlite row value misued error on INSERT.
net.IP
row value misued
I did not create a playground PR because this is so simple to reproduce:
package main import ( "net" "gorm.io/gorm" "gorm.io/driver/sqlite" ) type Client struct { gorm.Model SourceIP net.IP } func main() { db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{}) if err != nil { panic("Failed to connect to db") } db.AutoMigrate(&Client{}) db.Create(&Client{ SourceIP: net.ParseIP("192.168.1.1"), }) }
Output:
2021/03/21 00:33:35 gorm-sqlite-netIP/main.go:22 row value misused [0.134ms] [rows:0] INSERT INTO `clients` (`created_at`,`updated_at`,`deleted_at`,`source_ip`) VALUES ("2021-03-21 00:33:35.378","2021-03-21 00:33:35.378",NULL,(0,0,0,0,0,0,0,0,0,0,255,255,192,168,1,1))
This happens in the sqlite3 CLI also:
sqlite3
sqlite> INSERT INTO `clients` (`created_at`,`updated_at`,`deleted_at`,`source_ip`) VALUES ("2021-03-21 00:33:35.378","2021-03-21 00:33:35.378",NULL,(0,0,0,0,0,0,0,0,0,0,255,255,192,168,1,1)); Error: row value misused
It seems that the nested parenthesis syntax for a BLOB is not correct.
The text was updated successfully, but these errors were encountered:
Which seems works with latest version.
Sorry, something went wrong.
Merge pull request go-gorm#36 from glebarez/orig
5f91b4e
Orig
jinzhu
No branches or pull requests
Description
Attempting to use a
net.IP
field in a gorm model causes a sqliterow value misued
error on INSERT.To Reproduce
I did not create a playground PR because this is so simple to reproduce:
Output:
This happens in the
sqlite3
CLI also:It seems that the nested parenthesis syntax for a BLOB is not correct.
The text was updated successfully, but these errors were encountered: