aboutsummaryrefslogtreecommitdiffstats
path: root/models/db
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-08-14 04:50:55 +0200
committerGitHub <noreply@github.com>2023-08-14 02:50:55 +0000
commitecd51f710b7b08eddc952d518f0d097367221388 (patch)
treeefef4d3efadc0480af58b270b6c93a9aecfdc421 /models/db
parent56b6b2b88ef175cc18d2ccdb86c220e885a24262 (diff)
downloadgitea-ecd51f710b7b08eddc952d518f0d097367221388.tar.gz
gitea-ecd51f710b7b08eddc952d518f0d097367221388.zip
Fix NuGet search endpoints (#25613)
Fixes #25564 Fixes #23191 - Api v2 search endpoint should return only the latest version matching the query - Api v3 search endpoint should return `take` packages not package versions
Diffstat (limited to 'models/db')
-rw-r--r--models/db/common.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/models/db/common.go b/models/db/common.go
index 2a5043a8e7..ea628bf2a0 100644
--- a/models/db/common.go
+++ b/models/db/common.go
@@ -37,3 +37,19 @@ func BuildCaseInsensitiveIn(key string, values []string) builder.Cond {
return builder.In("UPPER("+key+")", uppers)
}
+
+// BuilderDialect returns the xorm.Builder dialect of the engine
+func BuilderDialect() string {
+ switch {
+ case setting.Database.Type.IsMySQL():
+ return builder.MYSQL
+ case setting.Database.Type.IsSQLite3():
+ return builder.SQLITE
+ case setting.Database.Type.IsPostgreSQL():
+ return builder.POSTGRES
+ case setting.Database.Type.IsMSSQL():
+ return builder.MSSQL
+ default:
+ return ""
+ }
+}