postgres

package
v0.0.0-...-6c8972c Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewDevelopmentDB

func MustNewDevelopmentDB(ddlConnStr, migrationDir string) (*sqlx.DB, func())

MustNewDevelopmentDB creates a new isolated database for the use of a package test The checking of dbconn is expected to be done in the package test using this

func RandString

func RandString(n int) string

Types

type Storage

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

func NewStorage

func NewStorage(dbstring string, logger *logrus.Entry) (*Storage, error)

NewStorage returns a new Storage from the provides psql databse string

func NewStorageDB

func NewStorageDB(db *sqlx.DB) *Storage

func NewTestStorage

func NewTestStorage(dbstring string, migrationDir string) (*Storage, func())

NewTestStorage returns a Storage that uses an isolated database for testing purposes and a teardown function

func (*Storage) Commit

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

func (*Storage) CreateUser

func (s *Storage) CreateUser(ctx context.Context, user storage.User) (string, error)

func (*Storage) CreateUserInformation

func (s *Storage) CreateUserInformation(ctx context.Context, ui storage.UserInformation) (string, error)

func (*Storage) CreateUserInformationValidation

func (s *Storage) CreateUserInformationValidation(ctx context.Context, req storage.UserInformation) error

func (*Storage) DeleteUser

func (s *Storage) DeleteUser(ctx context.Context, u storage.User) error

func (*Storage) DeleteUserInformation

func (s *Storage) DeleteUserInformation(ctx context.Context, userID, deletedBy string) error

func (Storage) DeleteUserInformationPermanently

func (s Storage) DeleteUserInformationPermanently(ctx context.Context) error

func (*Storage) DeleteUserInformationValidation

func (s *Storage) DeleteUserInformationValidation(ctx context.Context, req string) error

func (Storage) GetUserByEmail

func (s Storage) GetUserByEmail(ctx context.Context, email string) (*storage.User, error)

func (Storage) GetUserByID

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

func (Storage) GetUserByUsername

func (s Storage) GetUserByUsername(ctx context.Context, username string) (*storage.User, error)

func (*Storage) GetUserInformation

func (s *Storage) GetUserInformation(ctx context.Context, userID string) (*storage.UserInformation, error)

func (*Storage) ListUsers

func (s *Storage) ListUsers(ctx context.Context, f storage.FilterUser) ([]storage.User, error)

func (*Storage) Login

func (s *Storage) Login(ctx context.Context, user storage.User) (*storage.User, error)

func (*Storage) NewTransacton

func (s *Storage) NewTransacton(ctx context.Context) (context.Context, error)

func (*Storage) Rollback

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

func (*Storage) RunMigration

func (s *Storage) RunMigration(dir string) error

RunMigration runs the migrations in the dir using the goose package

func (*Storage) UpdateUser

func (s *Storage) UpdateUser(ctx context.Context, u storage.User) (*storage.User, error)

func (*Storage) UpdateUserInformation

func (s *Storage) UpdateUserInformation(ctx context.Context, ui storage.UserInformation) (*storage.UserInformation, error)

Jump to

Keyboard shortcuts

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