summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-11-10 15:20:48 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2016-11-10 15:20:48 +0800
commit7dcc3bc3d7469770fa020c1728b43522afca42d5 (patch)
tree8c08c77f52ebbc07601524e4c217fb2dddd84ace /models
parent145648a2334ea4583cb51f2e95df2df366b17416 (diff)
downloadgitea-7dcc3bc3d7469770fa020c1728b43522afca42d5.tar.gz
gitea-7dcc3bc3d7469770fa020c1728b43522afca42d5.zip
use x.SQL instead of x.Sql
Diffstat (limited to 'models')
-rw-r--r--models/migrations/migrations.go2
-rw-r--r--models/models.go2
-rw-r--r--models/org.go4
-rw-r--r--models/user.go2
4 files changed, 5 insertions, 5 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index 66e5d831e8..7b4c6ec53e 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -628,7 +628,7 @@ func convertDateToUnix(x *xorm.Engine) (err error) {
offset := 0
for {
beans := make([]*Bean, 0, 100)
- if err = x.Sql(fmt.Sprintf("SELECT * FROM `%s` ORDER BY id ASC LIMIT 100 OFFSET %d",
+ if err = x.SQL(fmt.Sprintf("SELECT * FROM `%s` ORDER BY id ASC LIMIT 100 OFFSET %d",
table.name, offset)).Find(&beans); err != nil {
return fmt.Errorf("select beans [table: %s, offset: %d]: %v", table.name, offset, err)
}
diff --git a/models/models.go b/models/models.go
index d6c30e1013..7714174707 100644
--- a/models/models.go
+++ b/models/models.go
@@ -33,7 +33,7 @@ type Engine interface {
Insert(...interface{}) (int64, error)
InsertOne(interface{}) (int64, error)
Iterate(interface{}, xorm.IterFunc) error
- Sql(string, ...interface{}) *xorm.Session
+ SQL(interface{}, ...interface{}) *xorm.Session
Where(interface{}, ...interface{}) *xorm.Session
}
diff --git a/models/org.go b/models/org.go
index 9583e20927..7b0e6a1078 100644
--- a/models/org.go
+++ b/models/org.go
@@ -494,7 +494,7 @@ func (org *User) GetUserRepositories(userID int64, page, pageSize int) ([]*Repos
}
repos := make([]*Repository, 0, pageSize)
// FIXME: use XORM chain operations instead of raw SQL.
- if err = x.Sql(fmt.Sprintf(`SELECT repository.* FROM repository
+ if err = x.SQL(fmt.Sprintf(`SELECT repository.* FROM repository
INNER JOIN team_repo
ON team_repo.repo_id = repository.id
WHERE (repository.owner_id = ? AND repository.is_private = ?) OR team_repo.team_id IN (%s)
@@ -533,7 +533,7 @@ func (org *User) GetUserMirrorRepositories(userID int64) ([]*Repository, error)
}
repos := make([]*Repository, 0, 10)
- if err = x.Sql(fmt.Sprintf(`SELECT repository.* FROM repository
+ if err = x.SQL(fmt.Sprintf(`SELECT repository.* FROM repository
INNER JOIN team_repo
ON team_repo.repo_id = repository.id AND repository.is_mirror = ?
WHERE (repository.owner_id = ? AND repository.is_private = ?) OR team_repo.team_id IN (%s)
diff --git a/models/user.go b/models/user.go
index 3870bdeb5a..21544eee0d 100644
--- a/models/user.go
+++ b/models/user.go
@@ -859,7 +859,7 @@ func UserPath(userName string) string {
func GetUserByKeyID(keyID int64) (*User, error) {
user := new(User)
- has, err := x.Sql("SELECT a.* FROM `user` AS a, public_key AS b WHERE a.id = b.owner_id AND b.id=?", keyID).Get(user)
+ has, err := x.SQL("SELECT a.* FROM `user` AS a, public_key AS b WHERE a.id = b.owner_id AND b.id=?", keyID).Get(user)
if err != nil {
return nil, err
} else if !has {