postgres

package
v0.0.0-...-48c0a4b Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 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 DB

type DB struct {
	Pool *pgxpool.Pool
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, conf *config.Config) *DB

New init a db poll and return db instance. db have functions like Ping, Close, Migrate etc

func (*DB) Close

func (db *DB) Close()

func (*DB) Drop

func (db *DB) Drop() error

func (*DB) Migrate

func (db *DB) Migrate() error

Migrate do migration process

func (*DB) Ping

func (db *DB) Ping(ctx context.Context)

func (*DB) TruncateUserTable

func (db *DB) TruncateUserTable(ctx context.Context) error

type UserRepo

type UserRepo struct {
	DB *DB
}

func NewUserRepo

func NewUserRepo(db *DB) *UserRepo

func (UserRepo) Create

func (UserRepo) GetByEmail

func (ur UserRepo) GetByEmail(ctx context.Context, email string) (graphql_twitter.User, error)

func (UserRepo) GetByUsername

func (ur UserRepo) GetByUsername(ctx context.Context, username string) (graphql_twitter.User, error)

Jump to

Keyboard shortcuts

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