Documentation
¶
Index ¶
- func NewSecretRepository(config *config.AWS) (port.SecretRepository, error)
- func NewTokenService(config *config.Token, repository port.SecretRepository) (port.TokenService, error)
- type AuthService
- type SecretRepository
- type TokenService
- type User
- type UserRepository
- func (ur *UserRepository) CloseDB() error
- func (ur *UserRepository) CreateUser(ctx context.Context, user *domain.User) (*domain.User, error)
- func (ur *UserRepository) DeleteUser(ctx context.Context, id uint64) error
- func (ur *UserRepository) GetUserByEmail(ctx context.Context, email string) (*domain.User, error)
- func (ur *UserRepository) GetUserByID(ctx context.Context, id uint64) (*domain.User, error)
- func (ur *UserRepository) ListUsers(ctx context.Context, lastID uint64, limit uint64) ([]domain.User, error)
- func (ur *UserRepository) UpdateUser(ctx context.Context, user *domain.User) (*domain.User, error)
- type UserService
- func (us *UserService) DeleteUser(ctx context.Context, id uint64) error
- func (us *UserService) GetUser(ctx context.Context, id uint64) (*domain.User, error)
- func (us *UserService) ListUsers(ctx context.Context, skip, limit uint64) ([]domain.User, error)
- func (us *UserService) Register(ctx context.Context, user *domain.User) (*domain.User, error)
- func (us *UserService) UpdateUser(ctx context.Context, user *domain.User) (*domain.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSecretRepository ¶
func NewSecretRepository(config *config.AWS) (port.SecretRepository, error)
func NewTokenService ¶
func NewTokenService(config *config.Token, repository port.SecretRepository) (port.TokenService, error)
NewTokenService creates a new TokenService instance
Types ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
*
- AuthService implements port.AuthService interface
- and provides an access to the user repository
- and token service
func NewAuthService ¶
func NewAuthService(repo port.UserRepository, ts port.TokenService) *AuthService
NewAuthService creates a new auth service instance
type SecretRepository ¶
type SecretRepository struct {
// contains filtered or unexported fields
}
func (*SecretRepository) GetTokenSecret ¶
func (s *SecretRepository) GetTokenSecret(param domain.SecretGetParam) (domain.SecretGetResponse, error)
func (*SecretRepository) UpdateTokenSecret ¶
func (s *SecretRepository) UpdateTokenSecret(param domain.SecretUpdateParam) (domain.SecretUpdateResponse, error)
type TokenService ¶
type TokenService struct {
// contains filtered or unexported fields
}
*
- TokenService implements port.TokenService interface
- Provide an access to the paseto library -> go-paseto
- TokenService は port.TokenService インターフェースを実装する。
- paseto ライブラリへのアクセスを提供する -> go-paseto
func (*TokenService) CreateToken ¶
func (pt *TokenService) CreateToken(user *domain.User) (string, error)
CreateToken creates a new paseto token
func (*TokenService) VerifyToken ¶
func (pt *TokenService) VerifyToken(token string) (*domain.TokenPayload, error)
VerifyToken verifies the paseto token
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
*
- UserRepository implements port.UserRepository interface
- and provides an access to the postgres database
- UserRepository は port.UserRepository インターフェースを実装しています。
- postgres データベースへのアクセスを提供します。
func NewCustomWayRespository ¶
func NewCustomWayRespository(db *gorm.DB) *UserRepository
The gorm will abstract all the db action. Make this service easy to change db endpoint. gormはすべてのdbアクションを抽象化する。dbのエンドポイントを簡単に変更できるようにする。
func NewUserRepository ¶
func NewUserRepository(config *config.DB) (*UserRepository, error)
func (*UserRepository) CloseDB ¶
func (ur *UserRepository) CloseDB() error
func (*UserRepository) CreateUser ¶
func (*UserRepository) DeleteUser ¶
func (ur *UserRepository) DeleteUser(ctx context.Context, id uint64) error
func (*UserRepository) GetUserByEmail ¶
func (*UserRepository) GetUserByID ¶
func (*UserRepository) ListUsers ¶
func (ur *UserRepository) ListUsers(ctx context.Context, lastID uint64, limit uint64) ([]domain.User, error)
ListUsers lists all users from the database, paginated by ID
func (*UserRepository) UpdateUser ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
*
- UserService implements port.UserService interface
func NewUserService ¶
func NewUserService(repo port.UserRepository) *UserService
func (*UserService) DeleteUser ¶
func (us *UserService) DeleteUser(ctx context.Context, id uint64) error
DeleteUser deletes a user by ID
func (*UserService) Register ¶
Register creates a new user !Password will save to db !パスワードがDBに保存される
func (*UserService) UpdateUser ¶
UpdateUser updates a user's name, email, and password
Click to show internal directories.
Click to hide internal directories.