mysqlblog

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 2 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        int32          `json:"id"`
	PostId    int32          `json:"post_id"`
	UserId    int32          `json:"user_id"`
	Content   string         `json:"content"`
	CreatedAt sql.NullString `json:"created_at"`
}

type CountCommentsByPostRow

type CountCommentsByPostRow struct {
	Count int64
}

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 GetCommentRow

type GetCommentRow struct {
	Id        int32
	PostId    int32
	UserId    int32
	Content   string
	CreatedAt sql.NullString
}

type GetPostRow

type GetPostRow struct {
	Id        int32
	UserId    int32
	Title     string
	Content   sql.NullString
	Status    sql.NullString
	ViewCount *int32
	CreatedAt sql.NullString
}

type GetPostsForTagRow

type GetPostsForTagRow struct {
	Id        int32
	UserId    int32
	Title     string
	Content   sql.NullString
	Status    sql.NullString
	ViewCount *int32
	CreatedAt sql.NullString
}

type GetTagByNameRow

type GetTagByNameRow struct {
	Id          int32
	Name        string
	Description sql.NullString
	CreatedAt   sql.NullString
}

type GetTagRow

type GetTagRow struct {
	Id          int32
	Name        string
	Description sql.NullString
	CreatedAt   sql.NullString
}

type GetTagsForPostRow

type GetTagsForPostRow struct {
	Id          int32
	Name        string
	Description sql.NullString
	CreatedAt   sql.NullString
}

type GetUserByEmailRow

type GetUserByEmailRow struct {
	Id           int32
	Email        string
	Username     string
	PasswordHash string
	Status       sql.NullString
	CreatedAt    sql.NullString
}

type GetUserRow

type GetUserRow struct {
	Id           int32
	Email        string
	Username     string
	PasswordHash string
	Status       sql.NullString
	CreatedAt    sql.NullString
}

type ListCommentsByPostRow

type ListCommentsByPostRow struct {
	Id        int32
	PostId    int32
	UserId    int32
	Content   string
	CreatedAt sql.NullString
}

type ListCommentsByUserRow

type ListCommentsByUserRow struct {
	Id        int32
	PostId    int32
	UserId    int32
	Content   string
	CreatedAt sql.NullString
}

type ListPostsByUserRow

type ListPostsByUserRow struct {
	Id        int32
	UserId    int32
	Title     string
	Content   sql.NullString
	Status    sql.NullString
	ViewCount *int32
	CreatedAt sql.NullString
}

type ListPostsRow

type ListPostsRow struct {
	Id        int32
	UserId    int32
	Title     string
	Content   sql.NullString
	Status    sql.NullString
	ViewCount *int32
	CreatedAt sql.NullString
}

type ListTagsRow

type ListTagsRow struct {
	Id          int32
	Name        string
	Description sql.NullString
	CreatedAt   sql.NullString
}

type ListUsersRow

type ListUsersRow struct {
	Id           int32
	Email        string
	Username     string
	PasswordHash string
	Status       sql.NullString
	CreatedAt    sql.NullString
}

type Posts

type Posts struct {
	Id        int32          `json:"id"`
	UserId    int32          `json:"user_id"`
	Title     string         `json:"title"`
	Content   sql.NullString `json:"content"`
	Status    sql.NullString `json:"status"`
	ViewCount *int32         `json:"view_count"`
	CreatedAt sql.NullString `json:"created_at"`
}

type Querier

type Querier interface {
	AddTagToPost(ctx context.Context, postId int32, tagId int32) (sql.Result, error)
	CountCommentsByPost(ctx context.Context, postId int32) (CountCommentsByPostRow, error)
	CreateComment(ctx context.Context, postId int32, userId int32, content string) (QueryResult, error)
	CreatePost(ctx context.Context, userId int32, title string, content sql.NullString, status sql.NullString) (QueryResult, error)
	CreateTag(ctx context.Context, name string, description sql.NullString) (QueryResult, error)
	CreateUser(ctx context.Context, email string, username string, passwordHash string, status sql.NullString) (QueryResult, error)
	DeleteComment(ctx context.Context, id int32) (sql.Result, error)
	DeletePost(ctx context.Context, id int32) (sql.Result, error)
	DeleteTag(ctx context.Context, id int32) (sql.Result, error)
	GetComment(ctx context.Context, id int32) (GetCommentRow, error)
	GetPost(ctx context.Context, id int32) (GetPostRow, error)
	GetPostsForTag(ctx context.Context, tagId int32, limit *any) ([]GetPostsForTagRow, error)
	GetTag(ctx context.Context, id int32) (GetTagRow, error)
	GetTagByName(ctx context.Context, name string) (GetTagByNameRow, error)
	GetTagsForPost(ctx context.Context, postId int32) ([]GetTagsForPostRow, error)
	GetUser(ctx context.Context, id int32) (GetUserRow, error)
	GetUserByEmail(ctx context.Context, email string) (GetUserByEmailRow, error)
	IncrementPostViews(ctx context.Context, id int32) (sql.Result, error)
	ListCommentsByPost(ctx context.Context, postId int32, limit *any) ([]ListCommentsByPostRow, error)
	ListCommentsByUser(ctx context.Context, userId int32, limit *any) ([]ListCommentsByUserRow, error)
	ListPosts(ctx context.Context, status sql.NullString, limit *any) ([]ListPostsRow, error)
	ListPostsByUser(ctx context.Context, userId int32, status sql.NullString, limit *any) ([]ListPostsByUserRow, error)
	ListTags(ctx context.Context) ([]ListTagsRow, error)
	ListUsers(ctx context.Context, status sql.NullString, limit *any) ([]ListUsersRow, error)
	RemoveTagFromPost(ctx context.Context, postId int32, tagId int32) (sql.Result, error)
	UpdatePost(ctx context.Context, title string, content sql.NullString, status sql.NullString, id int32) (sql.Result, 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, postId int32, tagId int32) (sql.Result, error)

func (*Queries) CountCommentsByPost

func (q *Queries) CountCommentsByPost(ctx context.Context, postId int32) (CountCommentsByPostRow, error)

func (*Queries) CreateComment

func (q *Queries) CreateComment(ctx context.Context, postId int32, userId int32, content string) (QueryResult, error)

func (*Queries) CreatePost

func (q *Queries) CreatePost(ctx context.Context, userId int32, title string, content sql.NullString, status sql.NullString) (QueryResult, error)

func (*Queries) CreateTag

func (q *Queries) CreateTag(ctx context.Context, name string, description sql.NullString) (QueryResult, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, email string, username string, passwordHash string, status sql.NullString) (QueryResult, error)

func (*Queries) DeleteComment

func (q *Queries) DeleteComment(ctx context.Context, id int32) (sql.Result, error)

func (*Queries) DeletePost

func (q *Queries) DeletePost(ctx context.Context, id int32) (sql.Result, error)

func (*Queries) DeleteTag

func (q *Queries) DeleteTag(ctx context.Context, id int32) (sql.Result, error)

func (*Queries) GetComment

func (q *Queries) GetComment(ctx context.Context, id int32) (GetCommentRow, error)

func (*Queries) GetPost

func (q *Queries) GetPost(ctx context.Context, id int32) (GetPostRow, error)

func (*Queries) GetPostsForTag

func (q *Queries) GetPostsForTag(ctx context.Context, tagId int32, limit *any) ([]GetPostsForTagRow, error)

func (*Queries) GetTag

func (q *Queries) GetTag(ctx context.Context, id int32) (GetTagRow, error)

func (*Queries) GetTagByName

func (q *Queries) GetTagByName(ctx context.Context, name string) (GetTagByNameRow, error)

func (*Queries) GetTagsForPost

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

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, id int32) (GetUserRow, error)

func (*Queries) GetUserByEmail

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

func (*Queries) IncrementPostViews

func (q *Queries) IncrementPostViews(ctx context.Context, id int32) (sql.Result, error)

func (*Queries) ListCommentsByPost

func (q *Queries) ListCommentsByPost(ctx context.Context, postId int32, limit *any) ([]ListCommentsByPostRow, error)

func (*Queries) ListCommentsByUser

func (q *Queries) ListCommentsByUser(ctx context.Context, userId int32, limit *any) ([]ListCommentsByUserRow, error)

func (*Queries) ListPosts

func (q *Queries) ListPosts(ctx context.Context, status sql.NullString, limit *any) ([]ListPostsRow, error)

func (*Queries) ListPostsByUser

func (q *Queries) ListPostsByUser(ctx context.Context, userId int32, status sql.NullString, limit *any) ([]ListPostsByUserRow, error)

func (*Queries) ListTags

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

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context, status sql.NullString, limit *any) ([]ListUsersRow, error)

func (*Queries) RemoveTagFromPost

func (q *Queries) RemoveTagFromPost(ctx context.Context, postId int32, tagId int32) (sql.Result, error)

func (*Queries) UpdatePost

func (q *Queries) UpdatePost(ctx context.Context, title string, content sql.NullString, status sql.NullString, id int32) (sql.Result, error)

type QueryResult

type QueryResult struct {
	LastInsertID int64
	RowsAffected int64
}

type Tags

type Tags struct {
	Id          int32          `json:"id"`
	Name        string         `json:"name"`
	Description sql.NullString `json:"description"`
	CreatedAt   sql.NullString `json:"created_at"`
}

type Users

type Users struct {
	Id           int32          `json:"id"`
	Email        string         `json:"email"`
	Username     string         `json:"username"`
	PasswordHash string         `json:"password_hash"`
	Status       sql.NullString `json:"status"`
	CreatedAt    sql.NullString `json:"created_at"`
}

Jump to

Keyboard shortcuts

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