postgres

package
v0.0.0-...-7026ca7 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgresDB

func NewPostgresDB(ctx context.Context, cfg *config.DBConfig) (*pgx.Conn, error)

Types

type Repository

type Repository struct {
	User
}

func New

func New(db *pgx.Conn) *Repository

type User

type User interface {
	Create(ctx context.Context, user *model.User) error
	FindByID(ctx context.Context, id string) (*model.User, error)
	FindByLogin(ctx context.Context, login string) (*model.User, error)
	ExistsByLogin(ctx context.Context, login string) bool
}

type UserRepo

type UserRepo struct {
	// contains filtered or unexported fields
}

func NewUserRepo

func NewUserRepo(db *pgx.Conn) *UserRepo

func (*UserRepo) Create

func (r *UserRepo) Create(ctx context.Context, user *model.User) error

func (*UserRepo) ExistsByLogin

func (r *UserRepo) ExistsByLogin(ctx context.Context, login string) bool

func (*UserRepo) FindByID

func (r *UserRepo) FindByID(ctx context.Context, id string) (*model.User, error)

func (*UserRepo) FindByLogin

func (r *UserRepo) FindByLogin(ctx context.Context, login string) (*model.User, error)

Jump to

Keyboard shortcuts

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