mysqlblog

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: 2 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 int32
	TagId  int32
}

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 CreateCommentParams added in v0.11.0

type CreateCommentParams struct {
	PostId  int32
	UserId  int32
	Content string
}

type CreatePostParams added in v0.11.0

type CreatePostParams struct {
	UserId  int32
	Title   string
	Content sql.NullString
	Status  sql.NullString
}

type CreateTagParams added in v0.11.0

type CreateTagParams struct {
	Name        string
	Description sql.NullString
}

type CreateUserParams added in v0.11.0

type CreateUserParams struct {
	Email        string
	Username     string
	PasswordHash string
	Status       sql.NullString
}

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 GetPostsForTagParams added in v0.11.0

type GetPostsForTagParams struct {
	TagId int32
	Limit any
}

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 ListCommentsByPostParams added in v0.11.0

type ListCommentsByPostParams struct {
	PostId int32
	Limit  any
}

type ListCommentsByPostRow

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

type ListCommentsByUserParams added in v0.11.0

type ListCommentsByUserParams struct {
	UserId int32
	Limit  any
}

type ListCommentsByUserRow

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

type ListPostsByUserParams added in v0.11.0

type ListPostsByUserParams struct {
	UserId int32
	Status sql.NullString
	Limit  any
}

type ListPostsByUserRow

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

type ListPostsParams added in v0.11.0

type ListPostsParams struct {
	Status sql.NullString
	Limit  any
}

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 ListUsersParams added in v0.11.0

type ListUsersParams struct {
	Status sql.NullString
	Limit  any
}

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, arg AddTagToPostParams) error
	CountCommentsByPost(ctx context.Context, postId int32) (int64, error)
	CreateComment(ctx context.Context, arg CreateCommentParams) (QueryResult, error)
	CreatePost(ctx context.Context, arg CreatePostParams) (QueryResult, error)
	CreateTag(ctx context.Context, arg CreateTagParams) (QueryResult, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (QueryResult, error)
	DeleteComment(ctx context.Context, id int32) error
	DeletePost(ctx context.Context, id int32) error
	DeleteTag(ctx context.Context, id int32) error
	GetComment(ctx context.Context, id int32) (GetCommentRow, error)
	GetPost(ctx context.Context, id int32) (GetPostRow, error)
	GetPostsForTag(ctx context.Context, arg GetPostsForTagParams) ([]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) error
	ListCommentsByPost(ctx context.Context, arg ListCommentsByPostParams) ([]ListCommentsByPostRow, error)
	ListCommentsByUser(ctx context.Context, arg ListCommentsByUserParams) ([]ListCommentsByUserRow, error)
	ListPosts(ctx context.Context, arg ListPostsParams) ([]ListPostsRow, error)
	ListPostsByUser(ctx context.Context, arg ListPostsByUserParams) ([]ListPostsByUserRow, error)
	ListTags(ctx context.Context) ([]ListTagsRow, error)
	ListUsers(ctx context.Context, arg ListUsersParams) ([]ListUsersRow, error)
	RemoveTagFromPost(ctx context.Context, arg RemoveTagFromPostParams) error
	UpdatePost(ctx context.Context, arg UpdatePostParams) 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) CountCommentsByPost

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

func (*Queries) CreateComment

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

func (*Queries) CreatePost

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

func (*Queries) CreateTag

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

func (*Queries) CreateUser

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

func (*Queries) DeleteComment

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

func (*Queries) DeletePost

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

func (*Queries) DeleteTag

func (q *Queries) DeleteTag(ctx context.Context, id int32) 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, arg GetPostsForTagParams) ([]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) error

func (*Queries) ListCommentsByPost

func (q *Queries) ListCommentsByPost(ctx context.Context, arg ListCommentsByPostParams) ([]ListCommentsByPostRow, error)

func (*Queries) ListCommentsByUser

func (q *Queries) ListCommentsByUser(ctx context.Context, arg ListCommentsByUserParams) ([]ListCommentsByUserRow, error)

func (*Queries) ListPosts

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

func (*Queries) ListPostsByUser

func (q *Queries) ListPostsByUser(ctx context.Context, arg ListPostsByUserParams) ([]ListPostsByUserRow, error)

func (*Queries) ListTags

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

func (*Queries) ListUsers

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

func (*Queries) RemoveTagFromPost

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

func (*Queries) UpdatePost

func (q *Queries) UpdatePost(ctx context.Context, arg UpdatePostParams) 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 int32
	TagId  int32
}

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 UpdatePostParams added in v0.11.0

type UpdatePostParams struct {
	Title   string
	Content sql.NullString
	Status  sql.NullString
	Id      int32
}

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