What version of Go and beego are you using (bee version)?
1.8.3
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/var/www/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build305098829=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
type My_table struct {
Id int
Name string
Current_date string `orm:"null"`
}
func UpdateMyTable() {
o := orm.NewOrm()
var table My_table
table.Name = "Bob"
id, err := o.Insert(&table)
}
@adel1ne
Hello, I want to know that is the issue solved now?
How to insert NULL into datetime type column?
I have the same issue
I have same issue when i using [email protected], is there a solution now?
https://github.com/astaxie/beego/blob/v1.11.1/orm/db.go#L376
https://github.com/astaxie/beego/blob/v1.11.1/orm/db.go#L185
When i insert a zero time, it will parse to the query like:
INSERT INTO `xx` (`other`,`my_time`) VALUES ('test',NULL)
This will cause failure, even though I set the default time in mysql.
Most helpful comment
@adel1ne
Hello, I want to know that is the issue solved now?
How to insert NULL into datetime type column?
I have the same issue