parent
d0567a63b4
commit
a50ce8d984
|
@ -1,14 +1,17 @@
|
||||||
## Contributing to xorm
|
## Contributing to xorm
|
||||||
|
|
||||||
`xorm` has a backlog of pull requests, but contributions are still very
|
`xorm` has a backlog of [pull requests](https://help.github.com/articles/using-pull-requests), but contributions are still very
|
||||||
much welcome. You can help with patch review, submitting bug reports,
|
much welcome. You can help with patch review, submitting bug reports,
|
||||||
or adding new functionality. There is no formal style guide, but
|
or adding new functionality. There is no formal style guide, but
|
||||||
please conform to the style of existing code and general Go formatting
|
please conform to the style of existing code and general Go formatting
|
||||||
conventions when submitting patches.
|
conventions when submitting patches.
|
||||||
|
|
||||||
|
* [fork a repo](https://help.github.com/articles/fork-a-repo)
|
||||||
|
* [creating a pull request ](https://help.github.com/articles/creating-a-pull-request)
|
||||||
|
|
||||||
### Patch review
|
### Patch review
|
||||||
|
|
||||||
Help review existing open pull requests by commenting on the code or
|
Help review existing open [pull requests](https://help.github.com/articles/using-pull-requests) by commenting on the code or
|
||||||
proposed functionality.
|
proposed functionality.
|
||||||
|
|
||||||
### Bug reports
|
### Bug reports
|
||||||
|
|
|
@ -78,6 +78,8 @@ Or
|
||||||
|
|
||||||
* [Gowalker](http://gowalker.org) - [github.com/Unknwon/gowalker](http://github.com/Unknwon/gowalker)
|
* [Gowalker](http://gowalker.org) - [github.com/Unknwon/gowalker](http://github.com/Unknwon/gowalker)
|
||||||
|
|
||||||
|
* [Gobuild.io](http://gobuild.io) - [github.com/shxsun/gobuild](http://github.com/shxsun/gobuild)
|
||||||
|
|
||||||
* [Sudo China](http://sudochina.com) - [github.com/insionng/toropress](http://github.com/insionng/toropress)
|
* [Sudo China](http://sudochina.com) - [github.com/insionng/toropress](http://github.com/insionng/toropress)
|
||||||
|
|
||||||
* [Godaily](http://godaily.org) - [github.com/govc/godaily](http://github.com/govc/godaily)
|
* [Godaily](http://godaily.org) - [github.com/govc/godaily](http://github.com/govc/godaily)
|
||||||
|
|
|
@ -81,6 +81,8 @@ xorm是一个简单而强大的Go语言ORM库. 通过它可以使数据库操作
|
||||||
|
|
||||||
* [Gowalker](http://gowalker.org) - [github.com/Unknwon/gowalker](http://github.com/Unknwon/gowalker)
|
* [Gowalker](http://gowalker.org) - [github.com/Unknwon/gowalker](http://github.com/Unknwon/gowalker)
|
||||||
|
|
||||||
|
* [Gobuild.io](http://gobuild.io) - [github.com/shxsun/gobuild](http://github.com/shxsun/gobuild)
|
||||||
|
|
||||||
* [Sudo China](http://sudochina.com) - [github.com/insionng/toropress](http://github.com/insionng/toropress)
|
* [Sudo China](http://sudochina.com) - [github.com/insionng/toropress](http://github.com/insionng/toropress)
|
||||||
|
|
||||||
* [Godaily](http://godaily.org) - [github.com/govc/godaily](http://github.com/govc/godaily)
|
* [Godaily](http://godaily.org) - [github.com/govc/godaily](http://github.com/govc/godaily)
|
||||||
|
|
3
mysql.go
3
mysql.go
|
@ -111,6 +111,7 @@ func (db *mysql) SqlType(c *Column) string {
|
||||||
switch t := c.SQLType.Name; t {
|
switch t := c.SQLType.Name; t {
|
||||||
case Bool:
|
case Bool:
|
||||||
res = TinyInt
|
res = TinyInt
|
||||||
|
c.Length = 1
|
||||||
case Serial:
|
case Serial:
|
||||||
c.IsAutoIncrement = true
|
c.IsAutoIncrement = true
|
||||||
c.IsPrimaryKey = true
|
c.IsPrimaryKey = true
|
||||||
|
@ -259,7 +260,7 @@ func (db *mysql) GetColumns(tableName string) ([]string, map[string]*Column, err
|
||||||
if col.SQLType.IsText() {
|
if col.SQLType.IsText() {
|
||||||
if col.Default != "" {
|
if col.Default != "" {
|
||||||
col.Default = "'" + col.Default + "'"
|
col.Default = "'" + col.Default + "'"
|
||||||
}else{
|
} else {
|
||||||
if col.DefaultIsEmpty {
|
if col.DefaultIsEmpty {
|
||||||
col.Default = "''"
|
col.Default = "''"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2627,7 +2627,7 @@ func (session *Session) innerInsert(bean interface{}) (int64, error) {
|
||||||
|
|
||||||
// Method InsertOne insert only one struct into database as a record.
|
// Method InsertOne insert only one struct into database as a record.
|
||||||
// The in parameter bean must a struct or a point to struct. The return
|
// The in parameter bean must a struct or a point to struct. The return
|
||||||
// parameter is lastInsertId and error
|
// parameter is inserted and error
|
||||||
func (session *Session) InsertOne(bean interface{}) (int64, error) {
|
func (session *Session) InsertOne(bean interface{}) (int64, error) {
|
||||||
err := session.newDb()
|
err := session.newDb()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue