Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationFactory ¶
type AuthenticationFactory interface { // NewAuthentication ... NewAuthentication() JWTSignParser }
AuthenticationFactory ...
type Factory ¶
type Factory interface { // NewUser creates a new User interactor NewUser() User }
Factory interface allows us to provide other parts of the system with a way to make instances of our use-case / interactors when they need to
func NewEngine ¶
func NewEngine(s StorageFactory, jwt AuthenticationFactory) Factory
NewEngine creates a new engine factory that will make use of the passed in StorageFactory for any data persistence needs.
type JWTSignParser ¶
type JWTSignParser interface { Sign(claims map[string]interface{}, secret string) (map[string]interface{}, error) Parse(tokenStr string, secret string) (map[string]interface{}, error) }
JWTSignParser ...
type StorageFactory ¶
type StorageFactory interface { // NewUserRepository returns a storage specific // UserRepository implementation NewUserRepository() UserRepository Close() }
StorageFactory acts as interface for storage methods performing actions against our database
type User ¶
type User interface { // RegisterUser used for registering of new user accounts RegisterUser(ctx context.Context, user domain.Register) (*domain.User, error) // UpdateUser used for update of a specific user account UpdateUser(ctx context.Context, user domain.User) (*domain.User, error) // PutUser used for ... user account PutUser(ctx context.Context, user domain.User) (*domain.User, error) // GetUserByID used for finding of a specific user account // by the passed identifier GetUserByID(ctx context.Context, id string) (*domain.User, error) // GetUserByUserName used for finding of a specific user account // by the passed username GetUserByUserName(ctx context.Context, username string) (*domain.User, error) // GetUserByEmailAddress used for finding of a specific user account // by the passed email address GetUserByEmailAddress(ctx context.Context, email string) (*domain.User, error) // LoginUser used for sign in of a user by authenticating // credentials username and password LoginUser(ctx context.Context, loginRequest domain.Login) (*domain.User, error) // ListAllUsers used for finding all user accounts // by the passed skip and take parameters ListAllUsers(ctx context.Context, skip uint64, take uint64) ([]domain.User, error) // DeleteUserAccount used for removing/deleting of a specific user account // by the passed user identifier DeleteUserAccount(ctx context.Context, id string) (bool, error) //GenerateToken ... GenerateToken(ctx context.Context, id string) (map[string]interface{}, error) // ParseToken ... ParseToken(token string) (map[string]interface{}, error) }
User ...
type UserRepository ¶
type UserRepository interface { // InsertUser used for inserts of new user accounts InsertUser(ctx context.Context, user *domain.User) error // FindUserByUsernameAndPassword used to do user authentication FindUserByUsernameAndPassword(ctx context.Context, username, password string) (*domain.User, error) // UpdateUser used for update of a specific user account UpdateUser(ctx context.Context, user domain.User) error // PutUser used for ... user account PutUser(ctx context.Context, user domain.User) error // FindUserByID used for finding of a specific user account // by the passed identifier FindUserByID(ctx context.Context, id string) (*domain.User, error) // FindUserByUserName used for finding of a specific user account // by the passed username FindUserByUserName(ctx context.Context, username string) (*domain.User, error) // FindUserByEmailAddress used for finding of a specific user account // by the passed email address FindUserByEmailAddress(ctx context.Context, email string) (*domain.User, error) // ListAllUsers used for finding all user accounts // by the passed skip and take parameters ListAllUsers(ctx context.Context, skip uint64, take uint64) ([]domain.User, error) // RemoveUserByID used for removing/deleting of a specific user account // by the passed unique identifier RemoveUserByID(ctx context.Context, id string) (bool, error) }
UserRepository acts as interface for user specific storage functions for actions against database layer
Click to show internal directories.
Click to hide internal directories.