Documentation ¶
Index ¶
- func FromJSON(i interface{}, r io.Reader) error
- func ToJSON(i interface{}, w io.Writer) error
- type AuthDB
- type DB
- func (d *DB) Close() error
- func (d *DB) Create(ctx context.Context, user *models.User) error
- func (d *DB) DeleteVerificationData(ctx context.Context, email string, ...) error
- func (d *DB) GetUserByEmail(ctx context.Context, email string) (*models.User, error)
- func (d *DB) GetUserByID(ctx context.Context, userID string) (*models.User, error)
- func (d *DB) GetVerificationData(ctx context.Context, email string, ...) (*models.VerificationData, error)
- func (d *DB) Open(config *utils.Configurations) error
- func (d *DB) SetDBLogger(logger *zap.Logger)
- func (d *DB) StoreVerificationData(ctx context.Context, verificationData *models.VerificationData) error
- func (d *DB) UpdatePassword(ctx context.Context, userID string, password string, tokenHash string) error
- func (d *DB) UpdateUserVerificationStatus(ctx context.Context, email string, status bool) error
- func (d *DB) UpdateUsername(ctx context.Context, user *models.User) error
- type GoDB
- type Validation
- type ValidationError
- type ValidationErrors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthDB ¶
type AuthDB interface { Create(ctx context.Context, user *models.User) error GetUserByEmail(ctx context.Context, email string) (*models.User, error) GetUserByID(ctx context.Context, userID string) (*models.User, error) UpdateUsername(ctx context.Context, user *models.User) error UpdateUserVerificationStatus(ctx context.Context, email string, status bool) error StoreVerificationData(ctx context.Context, verificationData *models.VerificationData) error GetVerificationData(ctx context.Context, email string, verificationDataType models.VerificationDataType) (*models.VerificationData, error) DeleteVerificationData(ctx context.Context, email string, verificationDataType models.VerificationDataType) error UpdatePassword(ctx context.Context, userID string, password string, tokenHash string) error }
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) DeleteVerificationData ¶
func (d *DB) DeleteVerificationData(ctx context.Context, email string, verificationDataType models.VerificationDataType) error
DeleteMailVerificationData deletes a used verification data
func (*DB) GetUserByEmail ¶
GetUserByEmail retrieves the user object having the given email, else returns error
func (*DB) GetUserByID ¶
GetUserByID retrieves the user object having the given ID, else returns error
func (*DB) GetVerificationData ¶
func (d *DB) GetVerificationData(ctx context.Context, email string, verificationDataType models.VerificationDataType) (*models.VerificationData, error)
GetMailVerificationCode retrieves the stored verification code.
func (*DB) SetDBLogger ¶
func (*DB) StoreVerificationData ¶
func (d *DB) StoreVerificationData(ctx context.Context, verificationData *models.VerificationData) error
StoreMailVerificationData adds a mail verification data to db
func (*DB) UpdatePassword ¶
func (d *DB) UpdatePassword(ctx context.Context, userID string, password string, tokenHash string) error
UpdatePassword updates the user password
func (*DB) UpdateUserVerificationStatus ¶
UpdateUserVerificationStatus updates user verification status to true
type Validation ¶
type Validation struct {
// contains filtered or unexported fields
}
Validation is the type for validator
func (*Validation) Validate ¶
func (v *Validation) Validate(i interface{}) ValidationErrors
Validate method validates the given struct based on the validate tags and returns validation error if any
type ValidationError ¶
type ValidationError struct {
validator.FieldError
}
ValidationError wraps the validator FieldError so we do not expose this to outside code
func (ValidationError) Error ¶
func (v ValidationError) Error() string
Error provides the string format of the validation error
type ValidationErrors ¶
type ValidationErrors []ValidationError
ValidationErrors is a wrapper for list of ValidationError
func (ValidationErrors) Errors ¶
func (v ValidationErrors) Errors() []string
Errors convert the ValidationErrors slice into string slice