Documentation ¶
Index ¶
- Variables
- type DatabaseOperations
- func (dbu *DatabaseOperations) Create(name, email, pass string, admin bool) error
- func (dbu *DatabaseOperations) Delete(email string) error
- func (dbu *DatabaseOperations) GetUser(email string) (*database.User, error)
- func (dbu *DatabaseOperations) Login(email, password string, exp time.Duration) (string, error)
- func (dbu *DatabaseOperations) SetPassword(user *database.User, newPassword, userTarget string) error
- type FakeOperations
- func (f *FakeOperations) Create(name, email, pass string, admin bool) error
- func (f *FakeOperations) Delete(email string) error
- func (f *FakeOperations) GetUser(email string) (*database.User, error)
- func (f *FakeOperations) Login(email, password string, exp time.Duration) (string, error)
- func (f *FakeOperations) SetPassword(user *database.User, newPassword, targetUser string) error
- type Operations
- type Service
- func (s *Service) Create(ctx context.Context, request *userpb.CreateRequest) (*userpb.Empty, error)
- func (s *Service) Delete(ctx context.Context, request *userpb.DeleteRequest) (*userpb.Empty, error)
- func (s *Service) Login(ctx context.Context, request *userpb.LoginRequest) (*userpb.LoginResponse, error)
- func (s *Service) RegisterService(grpcServer *grpc.Server)
- func (s *Service) SetPassword(ctx context.Context, request *userpb.SetPasswordRequest) (*userpb.Empty, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = status.Errorf(codes.NotFound, "User not found") ErrUserAlreadyExists = status.Errorf(codes.AlreadyExists, "User already exists") ErrInvalidPassword = status.Errorf(codes.InvalidArgument, "Invalid password") ErrInvalidEmail = status.Errorf(codes.InvalidArgument, "Invalid e-mail") )
Functions ¶
This section is empty.
Types ¶
type DatabaseOperations ¶
func (*DatabaseOperations) Create ¶
func (dbu *DatabaseOperations) Create(name, email, pass string, admin bool) error
func (*DatabaseOperations) Delete ¶
func (dbu *DatabaseOperations) Delete(email string) error
func (*DatabaseOperations) GetUser ¶
func (dbu *DatabaseOperations) GetUser(email string) (*database.User, error)
func (*DatabaseOperations) SetPassword ¶
func (dbu *DatabaseOperations) SetPassword(user *database.User, newPassword, userTarget string) error
type FakeOperations ¶
type FakeOperations struct { Storage map[string]*database.User // contains filtered or unexported fields }
func (*FakeOperations) Create ¶
func (f *FakeOperations) Create(name, email, pass string, admin bool) error
func (*FakeOperations) Delete ¶
func (f *FakeOperations) Delete(email string) error
func (*FakeOperations) GetUser ¶
func (f *FakeOperations) GetUser(email string) (*database.User, error)
func (*FakeOperations) SetPassword ¶
func (f *FakeOperations) SetPassword(user *database.User, newPassword, targetUser string) error
type Operations ¶
type Operations interface { Login(email, password string, exp time.Duration) (string, error) GetUser(email string) (*database.User, error) SetPassword(user *database.User, newPassword, userTarget string) error Delete(email string) error Create(name, email, pass string, admin bool) error }
func NewDatabaseOperations ¶
func NewDatabaseOperations(db *gorm.DB, a auth.Auth) Operations
func NewFakeOperations ¶
func NewFakeOperations() Operations
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(ops Operations) *Service
func (*Service) Login ¶
func (s *Service) Login(ctx context.Context, request *userpb.LoginRequest) (*userpb.LoginResponse, error)
func (*Service) RegisterService ¶
func (*Service) SetPassword ¶
Click to show internal directories.
Click to hide internal directories.