postgresqldb

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 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 Comments

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

type CreateCommentRow

type CreateCommentRow struct {
	Id          uuid.UUID
	PostId      *uuid.UUID
	UserId      *uuid.UUID
	Commentbody pgtype.Text
	Likes       pgtype.Int4
	CreatedAt   *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 CreateTagRow

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

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   pgtype.Int4
}

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, arg1 *uuid.UUID, arg2 *uuid.UUID) (sql.Result, error)
	CreateComment(ctx context.Context, arg1 *uuid.UUID, arg2 *uuid.UUID, arg3 pgtype.Text) (CreateCommentRow, error)
	CreatePost(ctx context.Context, arg1 *uuid.UUID, arg2 pgtype.Text, arg3 pgtype.Text, arg4 pgtype.Text, arg5 pgtype.Bool, arg52 *time.Time) (CreatePostRow, error)
	CreateTag(ctx context.Context, arg1 pgtype.Text, arg2 pgtype.Text) (CreateTagRow, error)
	CreateUser(ctx context.Context, arg1 pgtype.Text, arg2 pgtype.Text, arg3 *[]byte, arg4 pgtype.Text) (CreateUserRow, error)
	DeleteComment(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)
	DeletePost(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)
	DeleteTag(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)
	DeleteUser(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)
	GetCommentById(ctx context.Context, arg1 uuid.UUID) (GetCommentByIdRow, error)
	GetPopularPosts(ctx context.Context, arg1 pgtype.Int4) ([]GetPopularPostsRow, error)
	GetPostById(ctx context.Context, arg1 uuid.UUID) (GetPostByIdRow, error)
	GetPostsForTag(ctx context.Context, arg1 *uuid.UUID) ([]GetPostsForTagRow, error)
	GetTagById(ctx context.Context, arg1 uuid.UUID) (GetTagByIdRow, error)
	GetTagByName(ctx context.Context, arg1 pgtype.Text) (GetTagByNameRow, error)
	GetTagsForPost(ctx context.Context, arg1 *uuid.UUID) ([]GetTagsForPostRow, error)
	GetUserByEmail(ctx context.Context, arg1 pgtype.Text) (GetUserByEmailRow, error)
	GetUserById(ctx context.Context, arg1 uuid.UUID) (GetUserByIdRow, error)
	GetUserStats(ctx context.Context, arg1 uuid.UUID) (GetUserStatsRow, error)
	IncrementPostViews(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)
	LikeComment(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)
	ListActiveUsers(ctx context.Context) ([]ListActiveUsersRow, error)
	ListCommentsByPost(ctx context.Context, arg1 *uuid.UUID) ([]ListCommentsByPostRow, error)
	ListCommentsByUser(ctx context.Context, arg1 *uuid.UUID) ([]ListCommentsByUserRow, error)
	ListPosts(ctx context.Context) ([]ListPostsRow, error)
	ListPostsByUser(ctx context.Context, arg1 *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, arg1 *uuid.UUID, arg2 *uuid.UUID) (sql.Result, error)
	SearchPostsByCategory(ctx context.Context, arg1 pgtype.Int4) ([]SearchPostsByCategoryRow, error)
	SearchUsersByMetadata(ctx context.Context, arg1 pgtype.Int4) ([]SearchUsersByMetadataRow, error)
	SearchUsersByTag(ctx context.Context, arg1 pgtype.Int4) ([]SearchUsersByTagRow, error)
	UpdateComment(ctx context.Context, arg2 pgtype.Text, arg1 uuid.UUID) (UpdateCommentRow, error)
	UpdatePost(ctx context.Context, arg2 pgtype.Text, arg3 pgtype.Text, arg4 pgtype.Text, arg5 pgtype.Bool, arg52 pgtype.Int4, arg1 uuid.UUID) (UpdatePostRow, error)
	UpdateTag(ctx context.Context, arg2 pgtype.Text, arg3 pgtype.Text, arg1 uuid.UUID) (UpdateTagRow, error)
	UpdateUser(ctx context.Context, arg2 pgtype.Text, arg3 pgtype.Text, arg4 *[]byte, arg5 pgtype.Text, arg1 uuid.UUID) (UpdateUserRow, error)
}

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, arg1 *uuid.UUID, arg2 *uuid.UUID) (sql.Result, error)

func (*Queries) CreateComment

func (q *Queries) CreateComment(ctx context.Context, arg1 *uuid.UUID, arg2 *uuid.UUID, arg3 pgtype.Text) (CreateCommentRow, error)

func (*Queries) CreatePost

func (q *Queries) CreatePost(ctx context.Context, arg1 *uuid.UUID, arg2 pgtype.Text, arg3 pgtype.Text, arg4 pgtype.Text, arg5 pgtype.Bool, arg52 *time.Time) (CreatePostRow, error)

func (*Queries) CreateTag

func (q *Queries) CreateTag(ctx context.Context, arg1 pgtype.Text, arg2 pgtype.Text) (CreateTagRow, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg1 pgtype.Text, arg2 pgtype.Text, arg3 *[]byte, arg4 pgtype.Text) (CreateUserRow, error)

func (*Queries) DeleteComment

func (q *Queries) DeleteComment(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)

func (*Queries) DeletePost

func (q *Queries) DeletePost(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)

func (*Queries) DeleteTag

func (q *Queries) DeleteTag(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)

func (*Queries) GetCommentById

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

func (*Queries) GetPopularPosts

func (q *Queries) GetPopularPosts(ctx context.Context, arg1 pgtype.Int4) ([]GetPopularPostsRow, error)

func (*Queries) GetPostById

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

func (*Queries) GetPostsForTag

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

func (*Queries) GetTagById

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

func (*Queries) GetTagByName

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

func (*Queries) GetTagsForPost

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

func (*Queries) GetUserByEmail

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

func (*Queries) GetUserById

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

func (*Queries) GetUserStats

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

func (*Queries) IncrementPostViews

func (q *Queries) IncrementPostViews(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)

func (*Queries) LikeComment

func (q *Queries) LikeComment(ctx context.Context, arg1 uuid.UUID) (sql.Result, error)

func (*Queries) ListActiveUsers

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

func (*Queries) ListCommentsByPost

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

func (*Queries) ListCommentsByUser

func (q *Queries) ListCommentsByUser(ctx context.Context, arg1 *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, arg1 *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, arg1 *uuid.UUID, arg2 *uuid.UUID) (sql.Result, error)

func (*Queries) SearchPostsByCategory

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

func (*Queries) SearchUsersByMetadata

func (q *Queries) SearchUsersByMetadata(ctx context.Context, arg1 pgtype.Int4) ([]SearchUsersByMetadataRow, error)

func (*Queries) SearchUsersByTag

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

func (*Queries) UpdateComment

func (q *Queries) UpdateComment(ctx context.Context, arg2 pgtype.Text, arg1 uuid.UUID) (UpdateCommentRow, error)

func (*Queries) UpdatePost

func (q *Queries) UpdatePost(ctx context.Context, arg2 pgtype.Text, arg3 pgtype.Text, arg4 pgtype.Text, arg5 pgtype.Bool, arg52 pgtype.Int4, arg1 uuid.UUID) (UpdatePostRow, error)

func (*Queries) UpdateTag

func (q *Queries) UpdateTag(ctx context.Context, arg2 pgtype.Text, arg3 pgtype.Text, arg1 uuid.UUID) (UpdateTagRow, error)

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg2 pgtype.Text, arg3 pgtype.Text, arg4 *[]byte, arg5 pgtype.Text, arg1 uuid.UUID) (UpdateUserRow, error)

type QueryResult

type QueryResult struct {
	LastInsertID int64
	RowsAffected int64
}

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 UpdateCommentRow

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

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 UpdateTagRow

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

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