diff options
author | Unknwon <u@gogs.io> | 2017-06-07 01:19:32 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-06-07 01:19:32 -0400 |
commit | b40dc550ed15efd2c6faa1ea619888a400499a84 (patch) | |
tree | a5a064eed5e4e913fdbba23f8ab278844655863d /vendor/github.com/go-xorm/xorm/doc.go | |
parent | c210984b40a23f20bebe1f905ff6b1297c3ad901 (diff) |
vendor: update github.com/go-xorm/* (#4419)
Diffstat (limited to 'vendor/github.com/go-xorm/xorm/doc.go')
-rw-r--r-- | vendor/github.com/go-xorm/xorm/doc.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/vendor/github.com/go-xorm/xorm/doc.go b/vendor/github.com/go-xorm/xorm/doc.go index 5b36fcd8..51c3a2a8 100644 --- a/vendor/github.com/go-xorm/xorm/doc.go +++ b/vendor/github.com/go-xorm/xorm/doc.go @@ -8,7 +8,7 @@ Package xorm is a simple and powerful ORM for Go. Installation -Make sure you have installed Go 1.1+ and then: +Make sure you have installed Go 1.5+ and then: go get github.com/go-xorm/xorm @@ -51,11 +51,15 @@ There are 8 major ORM methods and many helpful methods to use to operate databas // INSERT INTO struct1 () values () // INSERT INTO struct2 () values (),(),() -2. Query one record from database +2. Query one record or one variable from database has, err := engine.Get(&user) // SELECT * FROM user LIMIT 1 + var id int64 + has, err := engine.Table("user").Where("name = ?", name).Get(&id) + // SELECT id FROM user WHERE name = ? LIMIT 1 + 3. Query multiple records from database var sliceOfStructs []Struct @@ -99,6 +103,9 @@ another is Rows counts, err := engine.Count(&user) // SELECT count(*) AS total FROM user + counts, err := engine.SQL("select count(*) FROM user").Count() + // select count(*) FROM user + 8. Sum records sumFloat64, err := engine.Sum(&user, "id") |