Compare commits
2 Commits
197e035f0b
...
b20bf61bf5
Author | SHA1 | Date | |
---|---|---|---|
|
b20bf61bf5 | ||
|
60c4aeed75 |
@ -3,6 +3,7 @@ package repository
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"gitee.ltd/lxh/logger/log"
|
"gitee.ltd/lxh/logger/log"
|
||||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@ -194,7 +195,7 @@ func (r clientRepo) GetById(id string) (data entity.Client, err error) {
|
|||||||
// @return data
|
// @return data
|
||||||
// @return err
|
// @return err
|
||||||
func (r clientRepo) GetByPublicKey(publicKey string) (data entity.Client, err error) {
|
func (r clientRepo) GetByPublicKey(publicKey string) (data entity.Client, err error) {
|
||||||
err = r.Model(&entity.Client{}).Where("json_extract(keys, '.publicKey') = '?'", publicKey).Preload("Server").First(&data).Error
|
err = r.Model(&entity.Client{}).Where(fmt.Sprintf("json_extract(keys, '$.publicKey') = '%s'", publicKey)).Preload("Server").First(&data).Error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user