diff options
Diffstat (limited to 'pkg/database/sql')
-rw-r--r-- | pkg/database/sql/user.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pkg/database/sql/user.go b/pkg/database/sql/user.go index 479a9c5..11718be 100644 --- a/pkg/database/sql/user.go +++ b/pkg/database/sql/user.go @@ -201,3 +201,20 @@ func (u *UserRepository) Any(ctx context.Context) (bool, error) { return exists, nil } + +func (u *UserRepository) GetPathFromUserID(ctx context.Context, id uint) (string, error) { + var userPath string + + result := u.db. + WithContext(ctx). + Model(&User{}). + Select("path"). + Where("id = ?", id). + First(&userPath) + + if result.Error != nil { + return "", result.Error + } + + return userPath, nil +} |