Skip to content

Commit

Permalink
✨ feat: support pure-Go SQLite driver for GORM
Browse files Browse the repository at this point in the history
  • Loading branch information
lwnmengjing committed May 1, 2024
1 parent 372c322 commit fb90a94
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
4 changes: 2 additions & 2 deletions pkg/config/gormdb/open.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//go:build !sqlite3

package gormdb

import (
"github.com/glebarez/sqlite"
dm "github.com/nfjBill/gorm-driver-dm"
"gorm.io/driver/mysql"
"gorm.io/driver/postgres"
Expand All @@ -13,4 +12,5 @@ var Opens = map[string]func(string) gorm.Dialector{
"mysql": mysql.Open,
"postgres": postgres.Open,
"dm": dm.Open,
"sqlite": sqlite.Open,
}
19 changes: 0 additions & 19 deletions pkg/config/gormdb/open_sqlite3.go

This file was deleted.

2 changes: 1 addition & 1 deletion virtual/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (m *Model) TenantScope(ctx *gin.Context,
_ = db.AddError(err)
return db
}
return db.Where(fmt.Sprintf("`%s`.`tenant_id` = ?", m.TableName()), tenantID)
return db.Where(fmt.Sprintf("%s.tenant_id = ?", m.TableName()), tenantID)
}
}

Expand Down

0 comments on commit fb90a94

Please sign in to comment.