repository

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const QueryCreateContact = `
INSERT INTO contacts(name, phones, description, user_id) VALUES($1, $2, $3, $4) 
RETURNING id;`
View Source
const QueryCreateUser = `
INSERT INTO users(email, password) VALUES($1, $2) 
RETURNING id;`
View Source
const QueryDeleteContact = `
DELETE FROM contacts 
WHERE user_id=$1 AND id=$2;`
View Source
const QueryGetContactById = `
SELECT name, phones, description
FROM contacts
WHERE user_id=$1 AND id=$2;`
View Source
const QueryGetContacts = `` /* 154-byte string literal not displayed */
View Source
const QueryGetUserByEmail = `
SELECT id, password, created_at
FROM users
WHERE email=$1;`
View Source
const QueryGetUserByEmailAndPassword = `
SELECT id, created_at 
FROM users 
WHERE email=$1 AND password=$2;`
View Source
const QueryGetUserDetailsById = `` /* 291-byte string literal not displayed */
View Source
const QueryUpdateContact = `
UPDATE contacts 
SET name=$1, phones=$2, description=$3 
WHERE user_id=$4 AND id=$5;`

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CursorSecret string `koanf:"cursor_secret"`
	Limit        struct {
		Min int `koanf:"min"`
		Max int `koanf:"max"`
	} `koanf:"limit"`
}

type Repository

type Repository interface {
	Migrate(models.Migrate) error

	CreateUser(user *models.User) error
	GetUserByEmail(email string) (*models.User, error)
	GetUserByEmailAndPassword(email, password string) (*models.User, error)

	CreateContact(userId uint64, contect *models.Contact) error
	GetContactById(userId, contactId uint64) (*models.Contact, error)
	UpdateContact(userId uint64, contact *models.Contact) error
	DeleteContact(userId, contactId uint64) error
	GetContacts(userId uint64, encryptedCursor, search string, limit int) ([]models.Contact, string, error)
}

func New

func New(logger *zap.Logger, cfg *Config, rdbms rdbms.RDBMS) Repository

Jump to

Keyboard shortcuts

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