Start refactoring
This commit is contained in:
31
data/datasource/pgsql/models/user/user.go
Normal file
31
data/datasource/pgsql/models/user/user.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"opensavecloudserver/data/datasource"
|
||||
"opensavecloudserver/data/repository/user"
|
||||
)
|
||||
|
||||
type (
|
||||
UserDatasource struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
)
|
||||
|
||||
func NewUserDatasource(dts datasource.Datasource) user.UserRepository {
|
||||
repo := new(UserDatasource)
|
||||
repo.db = dts.DB()
|
||||
return repo
|
||||
}
|
||||
|
||||
func (ud *UserDatasource) UserByID(ID user.ID) (user.User, error) {
|
||||
return nil, user.ErrUserNotFound
|
||||
}
|
||||
|
||||
func (ud *UserDatasource) UserByUsername(username string) (user.User, error) {
|
||||
return nil, user.ErrUserNotFound
|
||||
}
|
||||
|
||||
func (ud *UserDatasource) CreateUser(u user.NewUserTemplate) (user.User, error) {
|
||||
return nil, nil
|
||||
}
|
||||
Reference in New Issue
Block a user