postgres

package
v0.0.0-...-7a5cd37 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresContainer

type PostgresContainer struct {
	*postgres.PostgresContainer
	ConnectionString string
}

Вспомогательная структура контейнера для тестирования реализации на postgres

func CreatePostgresContainer

func CreatePostgresContainer(ctx context.Context) (*PostgresContainer, error)

type Store

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

Реализация интерфейса хранилища на postgresql

func New

func New(constr string, log *slog.Logger) (*Store, error)

Функция-конструктор хранилища на postgresql

func (*Store) Close

func (s *Store) Close() error

func (*Store) Post

func (s *Store) Post(id int) (models.Post, error)

func (*Store) Posts

func (s *Store) Posts(search string, page int) (models.Response, error)

Получение свежих новостей search - строка поиска в названии новости page - номер страницы

func (*Store) UpdatePosts

func (s *Store) UpdatePosts(posts []models.Post) error

Запись/Обновление новостей в хранилище

Jump to

Keyboard shortcuts

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