Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type User ¶
type User struct { ID string Email string EmailVerified bool ValidSince *time.Time Password string PasswordHash string PasswordUpdatedAt *time.Time Username string NormalizedUsername string GivenName string FamilyName string Name string Nickname string Picture string ConfirmationToken string ConfirmationSentAt *time.Time RecoveryToken string RecoverySentAt *time.Time EmailChangeToken string EmailChange string EmailChangeSentAt *time.Time AppMetaData jsonmap.JSONMap UserMetaData jsonmap.JSONMap LastIP string LastLoginAt *time.Time LoginsCount int64 Blocked bool CreatedAt time.Time UpdatedAt time.Time }
User respresents a registered user.
func (*User) IsConfirmed ¶
IsConfirmed checks if a user is already registered and confirmed.
type UserRepository ¶
type UserRepository interface { // Save saves a given entity. Save(ctx context.Context, entity *User) (*User, error) // FindByID retrieves an entity by its id. FindByID(ctx context.Context, id string) (*User, error) // ExistsByID returns whether an entity with the given id exists. ExistsByID(ctx context.Context, id string) (bool, error) // FindAll returns all instances of the type. FindAll(ctx context.Context, afterCursor string, limit int) ([]*User, string, error) // Count returns the number of entities available. Count(ctx context.Context) (int, error) // DeleteByID deletes the entity with the given id. DeleteByID(ctx context.Context, id string) error // Delete deletes a given entity. Delete(ctx context.Context, entity *User) error // DeleteAll deletes all entities managed by the repository. DeleteAll(ctx context.Context) error // ExistsByIdentifier returns whether an user with the given identifier // (username OR email) exists. ExistsByIdentifier(ctx context.Context, identifier string) (bool, error) // FindByIdentifier retrieves an user by its identifier (username OR email). FindByIdentifier(ctx context.Context, identifier string) (*User, error) // FindByConfirmationToken finds user with the matching confirmation token. FindByConfirmationToken(ctx context.Context, token string) (*User, error) // FindByRecoveryToken finds user with the matching recovery token. FindByRecoveryToken(ctx context.Context, token string) (*User, error) }
type UserUsecase ¶
type UserUsecase interface { // CreateUser creates new user in the system. CreateUser(context.Context, *User) (*User, error) // UpdateUser updates existing user. UpdateUser(context.Context, *User) (*User, error) // UpdatePassword updates existing user password. UpdatePassword(ctx context.Context, id string, password []byte) (*User, error) // ConfirmUser confirms existing user. ConfirmUser(ctx context.Context, id string) (*User, error) // ConfirmRecovery confirms recovery of user credentials via email. ConfirmRecovery(context.Context, *User) (*User, error) // ConfirmEmailChange confirms the change of email for a user. ConfirmEmailChange(context.Context, *User) (*User, error) // FindUserByID retrieves an user by ID. FindUserByID(context.Context, string) (*User, error) // FindUserByEmail retrieves an user by email. FindUserByEmail(context.Context, string) (*User, error) // FindUserByConfirmationToken finds user with the matching confirmation token. FindUserByConfirmationToken(context.Context, string) (*User, error) // FindUserByRecoveryToken finds a user with the matching recovery token. FindUserByRecoveryToken(context.Context, string) (*User, error) // Authenticate a user using password. Authenticate(ctx context.Context, identifier string, password []byte) (*User, error) // UserSignedIn updates last sign in time. UserSignedIn(ctx context.Context, user *User, ipAddress net.IP) (*User, error) // UpdateUserMetaData sets all user data from a map of updates, ensuring // that it doesn't override attributes that are not in the provided map. UpdateUserMetaData(ctx context.Context, user *User, updates map[string]interface{}) (*User, error) // UpdateAppMetaData updates all app data from a map of updates. UpdateAppMetaData(ctx context.Context, user *User, updates map[string]interface{}) (*User, error) }
Click to show internal directories.
Click to hide internal directories.