db

package
v0.0.0-...-4189b2e Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateLikeParams

type CreateLikeParams struct {
	SenderID   pgtype.UUID `json:"sender_id"`
	ReceiverID pgtype.UUID `json:"receiver_id"`
}

type CreateMatchParams

type CreateMatchParams struct {
	User1id pgtype.UUID `json:"user1id"`
	User2id pgtype.UUID `json:"user2id"`
}

type CreateUserParams

type CreateUserParams struct {
	Username    string   `json:"username"`
	Email       string   `json:"email"`
	Password    string   `json:"password"`
	Gender      string   `json:"gender"`
	University  string   `json:"university"`
	Picture     []byte   `json:"picture"`
	Bio         string   `json:"bio"`
	BioPictures []string `json:"bio_pictures"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type DeleteLikeParams

type DeleteLikeParams struct {
	SenderID   pgtype.UUID `json:"sender_id"`
	ReceiverID pgtype.UUID `json:"receiver_id"`
}

type DeleteMatchParams

type DeleteMatchParams struct {
	User1id pgtype.UUID `json:"user1id"`
	User2id pgtype.UUID `json:"user2id"`
}

type GetLikeByUsersParams

type GetLikeByUsersParams struct {
	SenderID   pgtype.UUID `json:"sender_id"`
	ReceiverID pgtype.UUID `json:"receiver_id"`
}

type GetMatchByUserIdParams

type GetMatchByUserIdParams struct {
	User1id pgtype.UUID `json:"user1id"`
	User2id pgtype.UUID `json:"user2id"`
}

type Like

type Like struct {
	ID         pgtype.UUID        `json:"id"`
	SenderID   pgtype.UUID        `json:"sender_id"`
	ReceiverID pgtype.UUID        `json:"receiver_id"`
	CreatedAt  pgtype.Timestamptz `json:"created_at"`
}

type LikeTxParams

type LikeTxParams struct {
	SenderID   pgtype.UUID `json:"sender_id"`
	ReceiverID pgtype.UUID `json:"receiver_id"`
}

type LikeTxResult

type LikeTxResult struct {
	Like  Like  `json:"like"`
	Match Match `json:"match"`
}

type ListMatchesParams

type ListMatchesParams struct {
	User1id pgtype.UUID `json:"user1id"`
	User2id pgtype.UUID `json:"user2id"`
}

type ListUsersParams

type ListUsersParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type Match

type Match struct {
	ID        pgtype.UUID        `json:"id"`
	User1id   pgtype.UUID        `json:"user1id"`
	User2id   pgtype.UUID        `json:"user2id"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type Message

type Message struct {
	ID         pgtype.UUID        `json:"id"`
	SenderID   pgtype.UUID        `json:"sender_id"`
	ReceiverID pgtype.UUID        `json:"receiver_id"`
	Content    pgtype.Text        `json:"content"`
	CreatedAt  pgtype.Timestamptz `json:"created_at"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateLike

func (q *Queries) CreateLike(ctx context.Context, arg CreateLikeParams) (Like, error)

func (*Queries) CreateMatch

func (q *Queries) CreateMatch(ctx context.Context, arg CreateMatchParams) (Match, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) DeleteLike

func (q *Queries) DeleteLike(ctx context.Context, arg DeleteLikeParams) error

func (*Queries) DeleteMatch

func (q *Queries) DeleteMatch(ctx context.Context, arg DeleteMatchParams) error

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, id pgtype.UUID) error

func (*Queries) GetLike

func (q *Queries) GetLike(ctx context.Context, id pgtype.UUID) (Like, error)

func (*Queries) GetLikeByUsers

func (q *Queries) GetLikeByUsers(ctx context.Context, arg GetLikeByUsersParams) (Like, error)

func (*Queries) GetMatchByMatchID

func (q *Queries) GetMatchByMatchID(ctx context.Context, id pgtype.UUID) (Match, error)

func (*Queries) GetMatchByUserId

func (q *Queries) GetMatchByUserId(ctx context.Context, arg GetMatchByUserIdParams) ([]Match, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, id pgtype.UUID) (User, error)

func (*Queries) GetUserByEmail

func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)

func (*Queries) ListLikesReceived

func (q *Queries) ListLikesReceived(ctx context.Context, receiverID pgtype.UUID) ([]Like, error)

func (*Queries) ListLikesSent

func (q *Queries) ListLikesSent(ctx context.Context, senderID pgtype.UUID) ([]Like, error)

func (*Queries) ListMatches

func (q *Queries) ListMatches(ctx context.Context, arg ListMatchesParams) ([]Match, error)

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context, arg ListUsersParams) ([]User, error)

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type Store

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

func NewStore

func NewStore(connPool *pgxpool.Pool) *Store

func (*Store) LikeTx

func (store *Store) LikeTx(ctx context.Context, arg LikeTxParams) (LikeTxResult, error)

LikeTx perform a like on one account to another check if like already exist, create a like record, check if there is a match, then create a match record if there is

type UpdateUserParams

type UpdateUserParams struct {
	ID          pgtype.UUID `json:"id"`
	Username    string      `json:"username"`
	Email       string      `json:"email"`
	Password    string      `json:"password"`
	Gender      string      `json:"gender"`
	University  string      `json:"university"`
	Picture     []byte      `json:"picture"`
	Bio         string      `json:"bio"`
	BioPictures []string    `json:"bio_pictures"`
}

type User

type User struct {
	ID          pgtype.UUID        `json:"id"`
	Username    string             `json:"username"`
	Email       string             `json:"email"`
	Password    string             `json:"password"`
	Gender      string             `json:"gender"`
	University  string             `json:"university"`
	Picture     []byte             `json:"picture"`
	Bio         string             `json:"bio"`
	BioPictures []string           `json:"bio_pictures"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
}

Jump to

Keyboard shortcuts

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