postgresqldb

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddTagToPostParams added in v0.11.0

type AddTagToPostParams struct {
	PostId  *uuid.UUID
	PostId2 *uuid.UUID
}

type Comments

type Comments struct {
	Id          uuid.UUID
	PostId      *uuid.UUID
	UserId      *uuid.UUID
	Commentbody pgtype.Text
	Likes       pgtype.Int4
	CreatedAt   pgtype.Timestamptz
}

type CreateCommentParams added in v0.11.0

type CreateCommentParams struct {
	PostId  *uuid.UUID
	PostId2 *uuid.UUID
	PostId3 pgtype.Text
}

type CreateCommentRow

type CreateCommentRow struct {
	Id          uuid.UUID
	PostId      *uuid.UUID
	UserId      *uuid.UUID
	Commentbody pgtype.Text
	Likes       pgtype.Int4
	CreatedAt   *time.Time
}

type CreatePostParams added in v0.11.0

type CreatePostParams struct {
	UserId  *uuid.UUID
	UserId2 pgtype.Text
	UserId3 pgtype.Text
	UserId4 pgtype.Text
	UserId5 pgtype.Bool
	UserId6 *time.Time
}

type CreatePostRow

type CreatePostRow struct {
	Id          uuid.UUID
	UserId      *uuid.UUID
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	ViewCount   pgtype.Int4
	Rating      *decimal.Decimal
	IsPublished pgtype.Bool
	PublishedAt *time.Time
	CreatedAt   *time.Time
	UpdatedAt   *time.Time
}

type CreateTagParams added in v0.11.0

type CreateTagParams struct {
	Tagname  pgtype.Text
	Tagname2 pgtype.Text
}

type CreateTagRow

type CreateTagRow struct {
	Id             uuid.UUID
	Tagname        pgtype.Text
	Tagdescription pgtype.Text
	CreatedAt      *time.Time
}

type CreateUserParams added in v0.11.0

type CreateUserParams struct {
	Username  pgtype.Text
	Username2 pgtype.Text
	Username3 *[]byte
	Username4 pgtype.Text
}

type CreateUserRow

type CreateUserRow struct {
	Id        uuid.UUID
	Username  pgtype.Text
	Useremail pgtype.Text
	Metadata  *[]byte
	Tags      pgtype.Text
	IsActive  pgtype.Bool
	CreatedAt *time.Time
	UpdatedAt *time.Time
}

type DBTX

type DBTX interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

type GetCommentByIdRow

type GetCommentByIdRow struct {
	Id          uuid.UUID
	PostId      *uuid.UUID
	UserId      *uuid.UUID
	Commentbody pgtype.Text
	Likes       pgtype.Int4
	CreatedAt   *time.Time
}

type GetPopularPostsRow

type GetPopularPostsRow struct {
	Id          uuid.UUID
	UserId      *uuid.UUID
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	ViewCount   pgtype.Int4
	Rating      *decimal.Decimal
	IsPublished pgtype.Bool
	PublishedAt *time.Time
	CreatedAt   *time.Time
	UpdatedAt   *time.Time
}

type GetPostByIdRow

type GetPostByIdRow struct {
	Id          uuid.UUID
	UserId      *uuid.UUID
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	ViewCount   pgtype.Int4
	Rating      *decimal.Decimal
	IsPublished pgtype.Bool
	PublishedAt *time.Time
	CreatedAt   *time.Time
	UpdatedAt   *time.Time
}

type GetPostsForTagRow

type GetPostsForTagRow struct {
	Id          uuid.UUID
	UserId      *uuid.UUID
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	ViewCount   pgtype.Int4
	Rating      *decimal.Decimal
	IsPublished pgtype.Bool
	PublishedAt *time.Time
	CreatedAt   *time.Time
	UpdatedAt   *time.Time
}

type GetTagByIdRow

type GetTagByIdRow struct {
	Id             uuid.UUID
	Tagname        pgtype.Text
	Tagdescription pgtype.Text
	CreatedAt      *time.Time
}

type GetTagByNameRow

type GetTagByNameRow struct {
	Id             uuid.UUID
	Tagname        pgtype.Text
	Tagdescription pgtype.Text
	CreatedAt      *time.Time
}

type GetTagsForPostRow

type GetTagsForPostRow struct {
	Id             uuid.UUID
	Tagname        pgtype.Text
	Tagdescription pgtype.Text
	CreatedAt      *time.Time
}

type GetUserByEmailRow

type GetUserByEmailRow struct {
	Id        uuid.UUID
	Username  pgtype.Text
	Useremail pgtype.Text
	Metadata  *[]byte
	Tags      pgtype.Text
	IsActive  pgtype.Bool
	CreatedAt *time.Time
	UpdatedAt *time.Time
}

type GetUserByIdRow

type GetUserByIdRow struct {
	Id        uuid.UUID
	Username  pgtype.Text
	Useremail pgtype.Text
	Metadata  *[]byte
	Tags      pgtype.Text
	IsActive  pgtype.Bool
	CreatedAt *time.Time
	UpdatedAt *time.Time
}

type GetUserStatsRow

type GetUserStatsRow struct {
	Id           uuid.UUID
	Username     pgtype.Text
	PostCount    int64
	CommentCount int64
	TotalViews   int32
}

type ListActiveUsersRow

type ListActiveUsersRow struct {
	Id        uuid.UUID
	Username  pgtype.Text
	Useremail pgtype.Text
	Metadata  *[]byte
	Tags      pgtype.Text
	IsActive  pgtype.Bool
	CreatedAt *time.Time
	UpdatedAt *time.Time
}

type ListCommentsByPostRow

type ListCommentsByPostRow struct {
	Id          uuid.UUID
	PostId      *uuid.UUID
	UserId      *uuid.UUID
	Commentbody pgtype.Text
	Likes       pgtype.Int4
	CreatedAt   *time.Time
}

type ListCommentsByUserRow

type ListCommentsByUserRow struct {
	Id          uuid.UUID
	PostId      *uuid.UUID
	UserId      *uuid.UUID
	Commentbody pgtype.Text
	Likes       pgtype.Int4
	CreatedAt   *time.Time
}

type ListPostsByUserRow

type ListPostsByUserRow struct {
	Id          uuid.UUID
	UserId      *uuid.UUID
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	ViewCount   pgtype.Int4
	Rating      *decimal.Decimal
	IsPublished pgtype.Bool
	PublishedAt *time.Time
	CreatedAt   *time.Time
	UpdatedAt   *time.Time
}

type ListPostsRow

type ListPostsRow struct {
	Id          uuid.UUID
	UserId      *uuid.UUID
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	ViewCount   pgtype.Int4
	Rating      *decimal.Decimal
	IsPublished pgtype.Bool
	PublishedAt *time.Time
	CreatedAt   *time.Time
	UpdatedAt   *time.Time
}

type ListPublishedPostsRow

type ListPublishedPostsRow struct {
	Id          uuid.UUID
	UserId      *uuid.UUID
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	ViewCount   pgtype.Int4
	Rating      *decimal.Decimal
	IsPublished pgtype.Bool
	PublishedAt *time.Time
	CreatedAt   *time.Time
	UpdatedAt   *time.Time
}

type ListTagsRow

type ListTagsRow struct {
	Id             uuid.UUID
	Tagname        pgtype.Text
	Tagdescription pgtype.Text
	CreatedAt      *time.Time
}

type ListUsersRow

type ListUsersRow struct {
	Id        uuid.UUID
	Username  pgtype.Text
	Useremail pgtype.Text
	Metadata  *[]byte
	Tags      pgtype.Text
	IsActive  pgtype.Bool
	CreatedAt *time.Time
	UpdatedAt *time.Time
}

type Posts

type Posts struct {
	Id          uuid.UUID
	UserId      *uuid.UUID
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	ViewCount   pgtype.Int4
	Rating      *decimal.Decimal
	IsPublished pgtype.Bool
	PublishedAt pgtype.Timestamptz
	CreatedAt   pgtype.Timestamptz
	UpdatedAt   pgtype.Timestamptz
}

type Querier

type Querier interface {
	AddTagToPost(ctx context.Context, arg AddTagToPostParams) error
	CreateComment(ctx context.Context, arg CreateCommentParams) (CreateCommentRow, error)
	CreatePost(ctx context.Context, arg CreatePostParams) (CreatePostRow, error)
	CreateTag(ctx context.Context, arg CreateTagParams) (CreateTagRow, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (CreateUserRow, error)
	DeleteComment(ctx context.Context, id uuid.UUID) error
	DeletePost(ctx context.Context, id uuid.UUID) error
	DeleteTag(ctx context.Context, id uuid.UUID) error
	DeleteUser(ctx context.Context, id uuid.UUID) error
	GetCommentById(ctx context.Context, id uuid.UUID) (GetCommentByIdRow, error)
	GetPopularPosts(ctx context.Context, limit any) ([]GetPopularPostsRow, error)
	GetPostById(ctx context.Context, id uuid.UUID) (GetPostByIdRow, error)
	GetPostsForTag(ctx context.Context, tagId *uuid.UUID) ([]GetPostsForTagRow, error)
	GetTagById(ctx context.Context, id uuid.UUID) (GetTagByIdRow, error)
	GetTagByName(ctx context.Context, tagname pgtype.Text) (GetTagByNameRow, error)
	GetTagsForPost(ctx context.Context, postId *uuid.UUID) ([]GetTagsForPostRow, error)
	GetUserByEmail(ctx context.Context, useremail pgtype.Text) (GetUserByEmailRow, error)
	GetUserById(ctx context.Context, id uuid.UUID) (GetUserByIdRow, error)
	GetUserStats(ctx context.Context, id uuid.UUID) (GetUserStatsRow, error)
	IncrementPostViews(ctx context.Context, id uuid.UUID) error
	LikeComment(ctx context.Context, id uuid.UUID) error
	ListActiveUsers(ctx context.Context) ([]ListActiveUsersRow, error)
	ListCommentsByPost(ctx context.Context, postId *uuid.UUID) ([]ListCommentsByPostRow, error)
	ListCommentsByUser(ctx context.Context, userId *uuid.UUID) ([]ListCommentsByUserRow, error)
	ListPosts(ctx context.Context) ([]ListPostsRow, error)
	ListPostsByUser(ctx context.Context, userId *uuid.UUID) ([]ListPostsByUserRow, error)
	ListPublishedPosts(ctx context.Context) ([]ListPublishedPostsRow, error)
	ListTags(ctx context.Context) ([]ListTagsRow, error)
	ListUsers(ctx context.Context) ([]ListUsersRow, error)
	RemoveTagFromPost(ctx context.Context, arg RemoveTagFromPostParams) error
	SearchPostsByCategory(ctx context.Context, any any) ([]SearchPostsByCategoryRow, error)
	SearchUsersByMetadata(ctx context.Context, p any) ([]SearchUsersByMetadataRow, error)
	SearchUsersByTag(ctx context.Context, any any) ([]SearchUsersByTagRow, error)
	UpdateComment(ctx context.Context, arg UpdateCommentParams) (UpdateCommentRow, error)
	UpdatePost(ctx context.Context, arg UpdatePostParams) (UpdatePostRow, error)
	UpdateTag(ctx context.Context, arg UpdateTagParams) (UpdateTagRow, error)
	UpdateUser(ctx context.Context, arg UpdateUserParams) (UpdateUserRow, error)
	WithTx(tx DBTX) *Queries
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddTagToPost

func (q *Queries) AddTagToPost(ctx context.Context, arg AddTagToPostParams) error

func (*Queries) CreateComment

func (q *Queries) CreateComment(ctx context.Context, arg CreateCommentParams) (CreateCommentRow, error)

func (*Queries) CreatePost

func (q *Queries) CreatePost(ctx context.Context, arg CreatePostParams) (CreatePostRow, error)

func (*Queries) CreateTag

func (q *Queries) CreateTag(ctx context.Context, arg CreateTagParams) (CreateTagRow, error)

func (*Queries) CreateUser

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

func (*Queries) DeleteComment

func (q *Queries) DeleteComment(ctx context.Context, id uuid.UUID) error

func (*Queries) DeletePost

func (q *Queries) DeletePost(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteTag

func (q *Queries) DeleteTag(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteUser

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

func (*Queries) GetCommentById

func (q *Queries) GetCommentById(ctx context.Context, id uuid.UUID) (GetCommentByIdRow, error)

func (*Queries) GetPopularPosts

func (q *Queries) GetPopularPosts(ctx context.Context, limit any) ([]GetPopularPostsRow, error)

func (*Queries) GetPostById

func (q *Queries) GetPostById(ctx context.Context, id uuid.UUID) (GetPostByIdRow, error)

func (*Queries) GetPostsForTag

func (q *Queries) GetPostsForTag(ctx context.Context, tagId *uuid.UUID) ([]GetPostsForTagRow, error)

func (*Queries) GetTagById

func (q *Queries) GetTagById(ctx context.Context, id uuid.UUID) (GetTagByIdRow, error)

func (*Queries) GetTagByName

func (q *Queries) GetTagByName(ctx context.Context, tagname pgtype.Text) (GetTagByNameRow, error)

func (*Queries) GetTagsForPost

func (q *Queries) GetTagsForPost(ctx context.Context, postId *uuid.UUID) ([]GetTagsForPostRow, error)

func (*Queries) GetUserByEmail

func (q *Queries) GetUserByEmail(ctx context.Context, useremail pgtype.Text) (GetUserByEmailRow, error)

func (*Queries) GetUserById

func (q *Queries) GetUserById(ctx context.Context, id uuid.UUID) (GetUserByIdRow, error)

func (*Queries) GetUserStats

func (q *Queries) GetUserStats(ctx context.Context, id uuid.UUID) (GetUserStatsRow, error)

func (*Queries) IncrementPostViews

func (q *Queries) IncrementPostViews(ctx context.Context, id uuid.UUID) error

func (*Queries) LikeComment

func (q *Queries) LikeComment(ctx context.Context, id uuid.UUID) error

func (*Queries) ListActiveUsers

func (q *Queries) ListActiveUsers(ctx context.Context) ([]ListActiveUsersRow, error)

func (*Queries) ListCommentsByPost

func (q *Queries) ListCommentsByPost(ctx context.Context, postId *uuid.UUID) ([]ListCommentsByPostRow, error)

func (*Queries) ListCommentsByUser

func (q *Queries) ListCommentsByUser(ctx context.Context, userId *uuid.UUID) ([]ListCommentsByUserRow, error)

func (*Queries) ListPosts

func (q *Queries) ListPosts(ctx context.Context) ([]ListPostsRow, error)

func (*Queries) ListPostsByUser

func (q *Queries) ListPostsByUser(ctx context.Context, userId *uuid.UUID) ([]ListPostsByUserRow, error)

func (*Queries) ListPublishedPosts

func (q *Queries) ListPublishedPosts(ctx context.Context) ([]ListPublishedPostsRow, error)

func (*Queries) ListTags

func (q *Queries) ListTags(ctx context.Context) ([]ListTagsRow, error)

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context) ([]ListUsersRow, error)

func (*Queries) RemoveTagFromPost

func (q *Queries) RemoveTagFromPost(ctx context.Context, arg RemoveTagFromPostParams) error

func (*Queries) SearchPostsByCategory

func (q *Queries) SearchPostsByCategory(ctx context.Context, any any) ([]SearchPostsByCategoryRow, error)

func (*Queries) SearchUsersByMetadata

func (q *Queries) SearchUsersByMetadata(ctx context.Context, p any) ([]SearchUsersByMetadataRow, error)

func (*Queries) SearchUsersByTag

func (q *Queries) SearchUsersByTag(ctx context.Context, any any) ([]SearchUsersByTagRow, error)

func (*Queries) UpdateComment

func (q *Queries) UpdateComment(ctx context.Context, arg UpdateCommentParams) (UpdateCommentRow, error)

func (*Queries) UpdatePost

func (q *Queries) UpdatePost(ctx context.Context, arg UpdatePostParams) (UpdatePostRow, error)

func (*Queries) UpdateTag

func (q *Queries) UpdateTag(ctx context.Context, arg UpdateTagParams) (UpdateTagRow, error)

func (*Queries) UpdateUser

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

func (*Queries) WithTx added in v0.11.0

func (q *Queries) WithTx(tx DBTX) *Queries

type QueryResult

type QueryResult struct {
	LastInsertID int64
	RowsAffected int64
}

type RemoveTagFromPostParams added in v0.11.0

type RemoveTagFromPostParams struct {
	PostId *uuid.UUID
	TagId  *uuid.UUID
}

type SearchPostsByCategoryRow

type SearchPostsByCategoryRow struct {
	Id          uuid.UUID
	UserId      *uuid.UUID
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	ViewCount   pgtype.Int4
	Rating      *decimal.Decimal
	IsPublished pgtype.Bool
	PublishedAt *time.Time
	CreatedAt   *time.Time
	UpdatedAt   *time.Time
}

type SearchUsersByMetadataRow

type SearchUsersByMetadataRow struct {
	Id        uuid.UUID
	Username  pgtype.Text
	Useremail pgtype.Text
	Metadata  *[]byte
	Tags      pgtype.Text
	IsActive  pgtype.Bool
	CreatedAt *time.Time
	UpdatedAt *time.Time
}

type SearchUsersByTagRow

type SearchUsersByTagRow struct {
	Id        uuid.UUID
	Username  pgtype.Text
	Useremail pgtype.Text
	Metadata  *[]byte
	Tags      pgtype.Text
	IsActive  pgtype.Bool
	CreatedAt *time.Time
	UpdatedAt *time.Time
}

type Tags

type Tags struct {
	Id             uuid.UUID
	Tagname        pgtype.Text
	Tagdescription pgtype.Text
	CreatedAt      pgtype.Timestamptz
}

type UpdateCommentParams added in v0.11.0

type UpdateCommentParams struct {
	Commentbody pgtype.Text
	Id          uuid.UUID
}

type UpdateCommentRow

type UpdateCommentRow struct {
	Id          uuid.UUID
	PostId      *uuid.UUID
	UserId      *uuid.UUID
	Commentbody pgtype.Text
	Likes       pgtype.Int4
	CreatedAt   *time.Time
}

type UpdatePostParams added in v0.11.0

type UpdatePostParams struct {
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	IsPublished pgtype.Bool
	PublishedAt any
	Id          uuid.UUID
}

type UpdatePostRow

type UpdatePostRow struct {
	Id          uuid.UUID
	UserId      *uuid.UUID
	Title       pgtype.Text
	Postbody    pgtype.Text
	Categories  pgtype.Text
	ViewCount   pgtype.Int4
	Rating      *decimal.Decimal
	IsPublished pgtype.Bool
	PublishedAt *time.Time
	CreatedAt   *time.Time
	UpdatedAt   *time.Time
}

type UpdateTagParams added in v0.11.0

type UpdateTagParams struct {
	Tagname        pgtype.Text
	Tagdescription pgtype.Text
	Id             uuid.UUID
}

type UpdateTagRow

type UpdateTagRow struct {
	Id             uuid.UUID
	Tagname        pgtype.Text
	Tagdescription pgtype.Text
	CreatedAt      *time.Time
}

type UpdateUserParams added in v0.11.0

type UpdateUserParams struct {
	Username  pgtype.Text
	Useremail pgtype.Text
	Metadata  *[]byte
	Tags      pgtype.Text
	Id        uuid.UUID
}

type UpdateUserRow

type UpdateUserRow struct {
	Id        uuid.UUID
	Username  pgtype.Text
	Useremail pgtype.Text
	Metadata  *[]byte
	Tags      pgtype.Text
	IsActive  pgtype.Bool
	CreatedAt *time.Time
	UpdatedAt *time.Time
}

type Users

type Users struct {
	Id        uuid.UUID
	Username  pgtype.Text
	Useremail pgtype.Text
	Metadata  *[]byte
	Tags      pgtype.Text
	IsActive  pgtype.Bool
	CreatedAt pgtype.Timestamptz
	UpdatedAt pgtype.Timestamptz
}

Jump to

Keyboard shortcuts

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