fix fmt
This commit is contained in:
parent
78c6153adf
commit
0b72f0266a
13
doc.go
13
doc.go
|
@ -3,16 +3,15 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
/*
|
||||
|
||||
Package xorm is a simple and powerful ORM for Go.
|
||||
|
||||
Installation
|
||||
# Installation
|
||||
|
||||
Make sure you have installed Go 1.11+ and then:
|
||||
|
||||
go get xorm.io/xorm
|
||||
|
||||
Create Engine
|
||||
# Create Engine
|
||||
|
||||
Firstly, we should create an engine for a database
|
||||
|
||||
|
@ -21,7 +20,7 @@ Firstly, we should create an engine for a database
|
|||
Method NewEngine's parameters are the same as sql.Open which depend drivers' implementation.
|
||||
Generally, one engine for an application is enough. You can define it as a package variable.
|
||||
|
||||
Raw Methods
|
||||
# Raw Methods
|
||||
|
||||
XORM supports raw SQL execution:
|
||||
|
||||
|
@ -41,7 +40,7 @@ XORM supports raw SQL execution:
|
|||
|
||||
affected, err := engine.Exec("update user set .... where ...")
|
||||
|
||||
ORM Methods
|
||||
# ORM Methods
|
||||
|
||||
There are 8 major ORM methods and many helpful methods to use to operate database.
|
||||
|
||||
|
@ -142,7 +141,7 @@ or
|
|||
sumInt64s, err := engine.SumsInt(&user, "id1", "id2")
|
||||
// SELECT sum(id1), sum(id2) from user
|
||||
|
||||
Conditions
|
||||
# Conditions
|
||||
|
||||
The above 8 methods could use with condition methods chainable.
|
||||
Notice: the above 8 methods should be the last chainable method.
|
||||
|
@ -204,7 +203,7 @@ Notice: the above 8 methods should be the last chainable method.
|
|||
engine.Join("LEFT", "userdetail", "user.id=userdetail.id").Find(&users)
|
||||
//SELECT * FROM user LEFT JOIN userdetail ON user.id=userdetail.id
|
||||
|
||||
Builder
|
||||
# Builder
|
||||
|
||||
xorm could work with xorm.io/builder directly.
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build dm
|
||||
// +build dm
|
||||
|
||||
package integrations
|
||||
|
|
|
@ -744,7 +744,8 @@ func TestInsertMap(t *testing.T) {
|
|||
assert.EqualValues(t, "lunny", ims[3].Name)
|
||||
}
|
||||
|
||||
/*INSERT INTO `issue` (`repo_id`, `poster_id`, ... ,`name`, `content`, ... ,`index`)
|
||||
/*
|
||||
INSERT INTO `issue` (`repo_id`, `poster_id`, ... ,`name`, `content`, ... ,`index`)
|
||||
SELECT $1, $2, ..., $14, $15, ..., MAX(`index`) + 1 FROM `issue` WHERE `repo_id` = $1;
|
||||
*/
|
||||
func TestInsertWhere(t *testing.T) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gojson
|
||||
// +build gojson
|
||||
|
||||
package json
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build jsoniter
|
||||
// +build jsoniter
|
||||
|
||||
package json
|
||||
|
|
|
@ -163,6 +163,7 @@ func (q Quoter) quoteWordTo(buf *strings.Builder, word string) error {
|
|||
}
|
||||
|
||||
// QuoteTo quotes the table or column names. i.e. if the quotes are [ and ]
|
||||
//
|
||||
// name -> [name]
|
||||
// `name` -> [name]
|
||||
// [name] -> [name]
|
||||
|
|
|
@ -145,6 +145,7 @@ func (session *Session) cacheUpdate(table *schemas.Table, tableName, sqlStr stri
|
|||
// Update records, bean's non-empty fields are updated contents,
|
||||
// condiBean' non-empty filds are conditions
|
||||
// CAUTION:
|
||||
//
|
||||
// 1.bool will defaultly be updated content nor conditions
|
||||
// You should call UseBool if you have bool to use.
|
||||
// 2.float32 & float64 may be not inexact as conditions
|
||||
|
|
Loading…
Reference in New Issue