postgre_db

package
v0.0.0-...-bb77d14 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB represents a PostgreSQL database connection pool.

func NewDB

func NewDB(ctx context.Context, connString string) (*DB, error)

NewDB creates a new DB instance with a connection pool. It takes a context and a connection string as parameters. It returns a pointer to a DB instance and an error. The error is returned if there was an issue parsing the connection string or creating the connection pool.

type TweetsPGRepository

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

func NewTweetRepository

func NewTweetRepository(db *DB) *TweetsPGRepository

func (*TweetsPGRepository) CreateTweet

func (tr *TweetsPGRepository) CreateTweet(ctx context.Context, tweet domain.Tweet) (domain.Tweet, error)

type UsersPGRepository

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

*

  • UsersPGRepository implements port.UsersRepository interface
  • and provides an access to the postgres database

func NewUserRepository

func NewUserRepository(db *DB) *UsersPGRepository

NewUserRepository creates a new user repository instance

func (*UsersPGRepository) CreateUser

func (ur *UsersPGRepository) CreateUser(ctx context.Context, user domain.User) (domain.User, error)

func (*UsersPGRepository) FollowUser

func (ur *UsersPGRepository) FollowUser(ctx context.Context, userID uuid.UUID, followedID uuid.UUID) error

func (*UsersPGRepository) GetFollowedUserIDs

func (ur *UsersPGRepository) GetFollowedUserIDs(ctx context.Context, userID uuid.UUID) ([]uuid.UUID, error)

func (*UsersPGRepository) GetFollowerIDs

func (ur *UsersPGRepository) GetFollowerIDs(ctx context.Context, userID uuid.UUID) ([]uuid.UUID, error)

func (*UsersPGRepository) GetUser

func (ur *UsersPGRepository) GetUser(ctx context.Context, id uuid.UUID) (domain.User, error)

func (*UsersPGRepository) GetUserTimeline

func (ur *UsersPGRepository) GetUserTimeline(ctx context.Context, userID uuid.UUID) ([]domain.Tweet, error)

Jump to

Keyboard shortcuts

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