go version
)?go version go1.8.3 linux/amd64
mysql 5.6.23
package main
import (
"log"
"github.com/shopspring/decimal"
)
func main() {
month := "201805"
t := "2018-05-07"
companyUser, _ := CompanyUserRepo.GetDaily(month, t)
for _, cu := range companyUser {
log.Println(cu.Ks3Storage)
}
}
type CompanyUser struct {
Ks3Storage float64 // or float32 or decimal.Decimal
}
var CompanyUserRepo = new(CompanyUser)
func (*CompanyUser) GetDaily(month string,
date string) ([]*CompanyUser, error) {
var cs []*CompanyUser
table := "company_user_201805"
err := db.LogMode(true).Table(table).Where("stat_date=?",
date).Find(&cs).Error
if err != nil {
return nil, err
}
return cs, nil
}
then output is always 0,whatever the real value is.
What am I doing wrong here ? Or how I should do ?
@jinzhu ,please!
@jinzhu Confirm that it would be nice and useful having this support!
This issue will be automatically closed because it is marked as GORM V1 issue, we have released the public testing GORM V2 release and its documents https://v2.gorm.io/docs/ already, the testing release has been used in some production services for a while, and going to release the final version in following weeks, we are still actively collecting feedback before it, please open a new issue for any suggestion or problem, thank you
Also check out https://github.com/go-gorm/gorm/wiki/GORM-V2-Release-Note-Draft for how to use the public testing version and its changelog
Most helpful comment
@jinzhu Confirm that it would be nice and useful having this support!