repository

package
v0.0.0-...-f6f4618 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

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
}

func New

func New(lg *zap.Logger, rdbms rdbms.RDBMS) Repository

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL