Documentation ¶
Index ¶
Constants ¶
View Source
const QueryCreateUser = `INSERT INTO users(first_name, last_name, email, password) VALUES($1, $2, $3, $4) RETURNING id;`
View Source
const QueryDeleteUser = "DELETE FROM users WHERE id=$1;"
View Source
const QueryFindUserByEmail = `
SELECT id, first_name, last_name, password, created_at
FROM users
WHERE email=$1;`
View Source
const QueryFindUserByEmailAndPassword = "SELECT id, first_name, last_name, created_at FROM users WHERE email=$1 AND password=$2;"
View Source
const QueryFindUserById = "SELECT first_name, last_name, email, password, created_at FROM users WHERE id=$1;"
View Source
const QueryUpdateUser = "UPDATE users SET first_name=?, last_name=?, password=? WHERE id=$1;"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface { MigrateUp(context.Context) error MigrateDown(context.Context) error CreateUser(ctx context.Context, user *models.User) error FindUserById(ctx context.Context, id uint64) (*models.User, error) FindUserByEmail(ctx context.Context, email string) (*models.User, error) FindUserByEmailAndPassword(ctx context.Context, email, password string) (*models.User, error) // UpdateUser will only updates the first_name and last_name or password UpdateUser(ctx context.Context, user *models.User) error DeleteUser(ctx context.Context, user *models.User) error }
Click to show internal directories.
Click to hide internal directories.