feat: adapt postgres (close #740)

This commit is contained in:
Xhofe
2022-03-22 16:41:38 +08:00
parent 801f843f8a
commit 9e483d902f
3 changed files with 18 additions and 5 deletions

View File

@ -159,7 +159,7 @@ func GetAccountById(id uint) (*Account, error) {
func GetAccountFiles() ([]File, error) {
files := make([]File, 0)
var accounts []Account
if err := conf.DB.Order("`index`").Find(&accounts).Error; err != nil {
if err := conf.DB.Order(columnName("index")).Find(&accounts).Error; err != nil {
return nil, err
}
for _, v := range accounts {
@ -179,7 +179,7 @@ func GetAccountFiles() ([]File, error) {
func GetAccounts() ([]Account, error) {
var accounts []Account
if err := conf.DB.Order("`index`").Find(&accounts).Error; err != nil {
if err := conf.DB.Order(columnName("index")).Find(&accounts).Error; err != nil {
return nil, err
}
return accounts, nil