Documentation
¶
Index ¶
- func ValidateEmail(v *validator.MyValidator, email string)
- func ValidateLogin(v *validator.MyValidator, login string)
- func ValidatePasswordPlaintext(v *validator.MyValidator, password string)
- func ValidatePaste(v *validator.MyValidator, p *models.Paste)
- func ValidateTokenPlaintext(v *validator.MyValidator, plaintext string)
- func ValidateUser(v *validator.MyValidator, user *models.User)
- type ActivateUserInput
- type AuthInput
- type AuthResp
- type Config
- type CreatePasteInput
- type Dependencies
- type ListPastesOutput
- type MessageResp
- type PastePermissionResponse
- type PasteResp
- type PasteService
- func (s *PasteService) Create(paste *models.Paste, creator *models.User) error
- func (s *PasteService) Delete(id uint16) error
- func (s *PasteService) GetList(settings SearchSettings, user *models.User) (*ListPastesOutput, error)
- func (s *PasteService) GetPaste(id uint16, user *models.User) (*models.Paste, error)
- func (s *PasteService) GetPasteForUpdate(pasteId uint16, in UpdatePasteInput) (*models.Paste, error)
- func (s *PasteService) GivePermission(pasteId uint16, userLogin string) (*PastePermissionResponse, error)
- func (s *PasteService) Update(paste *models.Paste) error
- type Pastes
- type RegistrationInput
- type ResetPasswordInput
- type SearchSettings
- type Services
- type UpdatePasswordInput
- type UpdatePasteInput
- type UserResp
- type UserService
- func (s *UserService) Activate(token string) (*models.User, error)
- func (s *UserService) ActivationRequest(user *models.User) error
- func (s *UserService) Login(email, password string) (*models.Token, error)
- func (s *UserService) Register(user *models.User) error
- func (s *UserService) ResetPasswordRequest(emailAddr string) error
- func (s *UserService) UpdatePassword(token, newPasswordPlain string) error
- type UserServiceConfig
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateEmail ¶
func ValidateEmail(v *validator.MyValidator, email string)
func ValidateLogin ¶
func ValidateLogin(v *validator.MyValidator, login string)
func ValidatePasswordPlaintext ¶
func ValidatePasswordPlaintext(v *validator.MyValidator, password string)
func ValidatePaste ¶
func ValidatePaste(v *validator.MyValidator, p *models.Paste)
func ValidateTokenPlaintext ¶
func ValidateTokenPlaintext(v *validator.MyValidator, plaintext string)
func ValidateUser ¶
func ValidateUser(v *validator.MyValidator, user *models.User)
Types ¶
type ActivateUserInput ¶
type ActivateUserInput struct {
TokenPlainText string `json:"token"`
}
type Config ¶
type Config struct { Host string Port int Env string Status string ActivationLink string ResetLink string Limiter struct { RPS float64 Burst int Enabled bool } CORS struct { TrustedOrigins config.StringSlice } BuildTime string Version string }
Config represents 'super-config' for all services
type CreatePasteInput ¶
type Dependencies ¶
type ListPastesOutput ¶
type MessageResp ¶
type MessageResp struct {
Message string `json:"message"`
}
type PastePermissionResponse ¶
type PastePermissionResponse struct {
Permission models.Permission `json:"permission"`
}
type PasteService ¶
type PasteService struct {
// contains filtered or unexported fields
}
func (*PasteService) Delete ¶
func (s *PasteService) Delete(id uint16) error
func (*PasteService) GetList ¶
func (s *PasteService) GetList(settings SearchSettings, user *models.User) (*ListPastesOutput, error)
func (*PasteService) GetPasteForUpdate ¶
func (s *PasteService) GetPasteForUpdate(pasteId uint16, in UpdatePasteInput) (*models.Paste, error)
func (*PasteService) GivePermission ¶
func (s *PasteService) GivePermission(pasteId uint16, userLogin string) (*PastePermissionResponse, error)
type Pastes ¶
type Pastes interface { GetList(settings SearchSettings, user *models.User) (*ListPastesOutput, error) GetPaste(id uint16, user *models.User) (*models.Paste, error) Delete(id uint16) error Create(paste *models.Paste, creator *models.User) error GetPasteForUpdate(pasteId uint16, in UpdatePasteInput) (*models.Paste, error) Update(paste *models.Paste) error GivePermission(pasteId uint16, userLogin string) (*PastePermissionResponse, error) }
type RegistrationInput ¶
type ResetPasswordInput ¶
type ResetPasswordInput struct {
Email string `json:"email"`
}
type SearchSettings ¶
type Services ¶
type Services struct { Config Deps Dependencies Pastes Pastes Users Users }
func New ¶
func New(cfg Config, deps Dependencies) *Services
type UpdatePasswordInput ¶
type UpdatePasteInput ¶
type UserService ¶
type UserService struct { *UserServiceConfig // contains filtered or unexported fields }
func (*UserService) ActivationRequest ¶
func (s *UserService) ActivationRequest(user *models.User) error
func (*UserService) Login ¶
func (s *UserService) Login(email, password string) (*models.Token, error)
func (*UserService) ResetPasswordRequest ¶
func (s *UserService) ResetPasswordRequest(emailAddr string) error
func (*UserService) UpdatePassword ¶
func (s *UserService) UpdatePassword(token, newPasswordPlain string) error
type UserServiceConfig ¶
type UserServiceConfig struct {
Environment string
}
Click to show internal directories.
Click to hide internal directories.