Comments (3)
i found it is a bug, thanks, i will fix it next week
from beedb.
i think this problem today, i find some problems
orm.Save(&thing)
i have to distinguish wherther it is insert or update
if you set a string pk,then if you use save function maybe always update.And if i support string then insert return LastInsertId will error. So now it's hard to support Primary key for other data type
from beedb.
我也遇到了类似的错误。如果没有if err != nil { orm = initDb() }
这部分代码,就有可能出现reflect: call of reflect.Value.Set on zero Value beedb
这个错误。如果有这部分代码,就不会出错了,但是原因我还没想明白。谢大能给看一下吗?
// 把微博数据保存到数据库
func saveWeibos(apiWeibos ApiWeiboList) {
orm := initDb()
for _, apiWeibo := range(apiWeibos.Statuses) {
weibo := Weibo{}
err := orm.Where("wid=?", apiWeibo.Id).Find(&weibo) // 更新或新建记录
//Check(err)
if err != nil { // No record found
orm = initDb()
}
weibo.Wid = apiWeibo.Id
weibo.Text = apiWeibo.Text
weibo.Created = getTime(apiWeibo.Created_At)
err = orm.Save(&weibo)
Check(err)
Debug("Weibo %d(%v) saved.", weibo.Wid, weibo.Created)
}
}
from beedb.
Related Issues (20)
- sql: statement expects 2 inputs; got 0
- Support auto create table by model
- Not support Oracle with go-oci8
- Saving in postgres fails HOT 1
- Support Custom Error types
- Got error in example HOT 1
- beedb 在pg上无法持久化数据
- can not work with postgresql
- Select() 方法,里面传递的表字段竟然有区分大小写,Why?
- delete 实体无法取得Id HOT 1
- mysql Date type cannot be parsed HOT 1
- sqlite delete
- Cannot get data when find by uid HOT 2
- save issue
- beedb Save遇到的一个问题 HOT 1
- 我更改了代码,使让框架支持了事物,你要不要 HOT 1
- mssql 用不了,连接不报错但是执行没有效果.建议用go-mssqldb(朋友请听进去!鬼知道我经历了什么) HOT 1
- 支持CSV文件的增删改查吗
- Delete()删除实体时的问题
- beedb 根据主键无法删除数据问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beedb.