aboutsummaryrefslogtreecommitdiffstats
path: root/models/db
diff options
context:
space:
mode:
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 ""
+ }
+}