Documentation
¶
Overview ¶
Package keeper - реализует хранение данных пользователей приложения
Index ¶
- type Keeper
- type StoragePG
- func (s *StoragePG) AddData(infoCell schema.InfoCell, memoryCell *schema.MemoryCell) (int64, error)
- func (s *StoragePG) CreateUser(user *schema.User) error
- func (s *StoragePG) DeleteData(infoIDs []int64) (bool, error)
- func (s *StoragePG) GetDataByInfoIDs(infoIDs []int64) ([]*schema.MemoryCell, error)
- func (s *StoragePG) GetUserByUsername(username string) (*schema.User, error)
- func (s *StoragePG) GetUserDataInfo(userID int64) ([]*schema.InfoCell, error)
- func (s *StoragePG) Ping() error
- func (s *StoragePG) UpdateInfoCell(infoCell schema.InfoCell) (bool, error)
- func (s *StoragePG) UpdateMemoryCell(memoryCell schema.MemoryCell) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper interface { GetUserDataInfo(userID int64) ([]*schema.InfoCell, error) GetDataByInfoIDs(infoIDs []int64) ([]*schema.MemoryCell, error) UpdateMemoryCell(memoryCell schema.MemoryCell) (bool, error) UpdateInfoCell(infoCell schema.InfoCell) (bool, error) AddData(infoCell schema.InfoCell, memoryCell *schema.MemoryCell) (int64, error) DeleteData(infoIDs []int64) (bool, error) GetUserByUsername(username string) (*schema.User, error) CreateUser(user *schema.User) error Ping() error }
Keeper представляет интерфейс для взаимодействия с базой данных.
type StoragePG ¶
type StoragePG struct {
// contains filtered or unexported fields
}
StoragePG представляет хранилище данных PostgreSQL.
func New ¶
func New(cfg config.ServerConfig) (*StoragePG, error)
New создает новый экземпляр StoragePG и устанавливает соединение с базой данных.
func (*StoragePG) CreateUser ¶
CreateUser создает нового пользователя.
func (*StoragePG) DeleteData ¶
DeleteData удаляет данные из базы данных на основе заданных InfoID.
func (*StoragePG) GetDataByInfoIDs ¶
func (s *StoragePG) GetDataByInfoIDs(infoIDs []int64) ([]*schema.MemoryCell, error)
GetDataByInfoIDs возвращает данные, соответствующие заданным InfoID.
func (*StoragePG) GetUserByUsername ¶
GetUserByUsername возвращает пользователя по его имени пользователя (username).
func (*StoragePG) GetUserDataInfo ¶
GetUserSavedDataInfo возвращает информацию о всех сохраненных данных пользователя по его ID.
func (*StoragePG) UpdateInfoCell ¶
UpdateInfoCell обновляет данные информационной ячейки на основе ID.
func (*StoragePG) UpdateMemoryCell ¶
func (s *StoragePG) UpdateMemoryCell(memoryCell schema.MemoryCell) (bool, error)
UpdateMemoryCell обновляет данные ячейки памяти на основе InfoID.