postgres

package
v0.0.0-...-eca08dd Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

type Storage

type Storage struct {
	Options Options
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, config config.Storage) (*Storage, error)

New initializes a new Storage instance with a database connection pool

It ensures a safe pool creation which persists across multiple calls until Stop is invoked.

func (*Storage) Ping

func (s *Storage) Ping(ctx context.Context) error

func (*Storage) SaveUser

func (s *Storage) SaveUser(ctx context.Context, email string, hash []byte) (uint64, error)

func (*Storage) Stop

func (s *Storage) Stop()

Stop closes the connection pool and clears its resources. Call New to reinitialize the pool after calling Stop.

func (*Storage) User

func (s *Storage) User(ctx context.Context, id string) (*models.User, error)

func (*Storage) UserByEmail

func (s *Storage) UserByEmail(ctx context.Context, email string) (*models.User, error)

Jump to

Keyboard shortcuts

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