Documentation
¶
Index ¶
Constants ¶
View Source
const (
UniqueViolationErr = "23505"
)
Variables ¶
View Source
var ( ErrNoDatastore = errors.New("no datastore provided") ErrRecordNotFound = errors.New("record not found") ErrInvalidDataType = errors.New("invalid user data type") ErrUniqueKeyViolated = errors.New("duplicated key not allowed") )
View Source
var ErrSvcUserExists = errors.New("target credential(s) already exist")
service errors
View Source
var ErrSvcUserNotFound = errors.New("target was not found")
Functions ¶
This section is empty.
Types ¶
type HTTPUserRequest ¶
type HTTPUserResponse ¶
type User ¶
type User struct {
ID string `gorm:"primaryKey"`
Username string `gorm:"unique"`
Email string `gorm:"unique"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
}
Shared model for Service and Repository layer
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func NewUserHandler ¶
func NewUserHandler(service UserServiceManager) *UserHandler
type UserRepoManager ¶
type UserRepoManager interface {
Create(user *User) error
GetAllUsers() ([]User, error)
GetUser(user *User) (User, error)
}
func NewUserRepository ¶
func NewUserRepository(db *gorm.DB, inMemStore config.MemoryStore) (UserRepoManager, error)
type UserServiceManager ¶
type UserServiceManager interface {
CreateUser(user User) (User, error)
GetAllUsers() ([]User, error)
GetUser(id string) (User, error)
}
func NewUserService ¶
func NewUserService(r UserRepoManager) UserServiceManager
Click to show internal directories.
Click to hide internal directories.