Documentation
¶
Index ¶
- Constants
- Variables
- func ErrorCode(err error) string
- type Admin
- type Article
- type Category
- type Comment
- type CountArticlesParams
- type CountSearchArticlesParams
- type CreateAdminParams
- type CreateArticleParams
- type CreateCategoryTxParams
- type CreateCategoryTxResult
- type CreateCommentParams
- type CreateSessionParams
- type CreateUserParams
- type CreateUserTxParams
- type CreateUserTxResult
- type CreateVerifyEmailParams
- type DBTX
- type DeleteArticleTxParams
- type DeleteCategoryTxParams
- type GetArticleBySlugRow
- type GetArticleForUpdateRow
- type GetArticleRow
- type ListAllArticlesParams
- type ListAllArticlesRow
- type ListArticlesByCategoryIDParams
- type ListArticlesByCategoryIDRow
- type ListArticlesParams
- type ListArticlesRow
- type ListCategoriesCountArticlesRow
- type ListCommentsByArticleIDRow
- type ListInitSysMenusRow
- type Querier
- type Queries
- func (q *Queries) AddCommentLikes(ctx context.Context, id int64) (Comment, error)
- func (q *Queries) CountAllArticles(ctx context.Context) (int64, error)
- func (q *Queries) CountArticles(ctx context.Context, arg CountArticlesParams) (int64, error)
- func (q *Queries) CountArticlesByCategoryID(ctx context.Context, categoryID int64) (int64, error)
- func (q *Queries) CountCategories(ctx context.Context) (int64, error)
- func (q *Queries) CountSearchArticles(ctx context.Context, arg CountSearchArticlesParams) (int64, error)
- func (q *Queries) CreateAdmin(ctx context.Context, arg CreateAdminParams) (Admin, error)
- func (q *Queries) CreateArticle(ctx context.Context, arg CreateArticleParams) (Article, error)
- func (q *Queries) CreateCategory(ctx context.Context, name string) (Category, error)
- func (q *Queries) CreateComment(ctx context.Context, arg CreateCommentParams) (Comment, error)
- func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
- func (q *Queries) CreateVerifyEmail(ctx context.Context, arg CreateVerifyEmailParams) (VerifyEmail, error)
- func (q *Queries) DeleteArticle(ctx context.Context, id uuid.UUID) error
- func (q *Queries) DeleteCategory(ctx context.Context, id int64) error
- func (q *Queries) DeleteChildComments(ctx context.Context, parentID int64) error
- func (q *Queries) DeleteComment(ctx context.Context, id int64) error
- func (q *Queries) DeleteCommentsByArticleID(ctx context.Context, articleID uuid.UUID) error
- func (q *Queries) GetAdmin(ctx context.Context, username string) (Admin, error)
- func (q *Queries) GetAdminById(ctx context.Context, id int64) (Admin, error)
- func (q *Queries) GetArticle(ctx context.Context, id uuid.UUID) (GetArticleRow, error)
- func (q *Queries) GetArticleBySlug(ctx context.Context, slug pgtype.Text) (GetArticleBySlugRow, error)
- func (q *Queries) GetArticleForUpdate(ctx context.Context, id uuid.UUID) (GetArticleForUpdateRow, error)
- func (q *Queries) GetCategory(ctx context.Context, id int64) (Category, error)
- func (q *Queries) GetCategoryByName(ctx context.Context, name string) (Category, error)
- func (q *Queries) GetComment(ctx context.Context, id int64) (Comment, error)
- func (q *Queries) GetSession(ctx context.Context, id uuid.UUID) (Session, error)
- func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error)
- func (q *Queries) GetUserByUsername(ctx context.Context, username string) (User, error)
- func (q *Queries) IncrementArticleLikes(ctx context.Context, id uuid.UUID) error
- func (q *Queries) IncrementArticleViews(ctx context.Context, id uuid.UUID) error
- func (q *Queries) ListAllArticles(ctx context.Context, arg ListAllArticlesParams) ([]ListAllArticlesRow, error)
- func (q *Queries) ListAllCategories(ctx context.Context) ([]Category, error)
- func (q *Queries) ListArticles(ctx context.Context, arg ListArticlesParams) ([]ListArticlesRow, error)
- func (q *Queries) ListArticlesByCategoryID(ctx context.Context, arg ListArticlesByCategoryIDParams) ([]ListArticlesByCategoryIDRow, error)
- func (q *Queries) ListCategoriesCountArticles(ctx context.Context) ([]ListCategoriesCountArticlesRow, error)
- func (q *Queries) ListCommentsByArticleID(ctx context.Context, articleID uuid.UUID) ([]ListCommentsByArticleIDRow, error)
- func (q *Queries) ListInitSysMenus(ctx context.Context, roleID int64) ([]ListInitSysMenusRow, error)
- func (q *Queries) SearchArticles(ctx context.Context, arg SearchArticlesParams) ([]SearchArticlesRow, error)
- func (q *Queries) SetArticleDefaultCategoryIdByCategoryId(ctx context.Context, categoryID int64) error
- func (q *Queries) UpdateAdmin(ctx context.Context, arg UpdateAdminParams) (Admin, error)
- func (q *Queries) UpdateArticle(ctx context.Context, arg UpdateArticleParams) (Article, error)
- func (q *Queries) UpdateCategory(ctx context.Context, arg UpdateCategoryParams) (Category, error)
- func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)
- func (q *Queries) UpdateVerifyEmail(ctx context.Context, arg UpdateVerifyEmailParams) (VerifyEmail, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type Role
- type RolePermission
- type SQLStore
- func (store *SQLStore) CreateCategoryTx(ctx context.Context, arg CreateCategoryTxParams) (CreateCategoryTxResult, error)
- func (store *SQLStore) CreateUserTx(ctx context.Context, arg CreateUserTxParams) (CreateUserTxResult, error)
- func (store *SQLStore) DeleteArticleTx(ctx context.Context, arg DeleteArticleTxParams) error
- func (store *SQLStore) DeleteCategoryTx(ctx context.Context, arg DeleteCategoryTxParams) error
- func (store *SQLStore) UpdateArticleTx(ctx context.Context, arg UpdateArticleTxParams) (UpdateArticleTxResult, error)
- func (store *SQLStore) UpdateCategoryTx(ctx context.Context, arg UpdateCategoryTxParams) (UpdateCategoryTxResult, error)
- func (store *SQLStore) VerifyEmailTx(ctx context.Context, arg VerifyEmailTxParams) (VerifyEmailTxResult, error)
- type SearchArticlesParams
- type SearchArticlesRow
- type Session
- type Store
- type SysMenu
- type Tag
- type UpdateAdminParams
- type UpdateArticleParams
- type UpdateArticleTxParams
- type UpdateArticleTxResult
- type UpdateCategoryParams
- type UpdateCategoryTxParams
- type UpdateCategoryTxResult
- type UpdateUserParams
- type UpdateVerifyEmailParams
- type User
- type VerifyEmail
- type VerifyEmailTxParams
- type VerifyEmailTxResult
Constants ¶
const ( ForeignKeyViolation = "23503" UniqueViolation = "23505" )
Variables ¶
var ErrRecordNotFound = pgx.ErrNoRows
var ErrUniqueViolation = &pgconn.PgError{Code: UniqueViolation}
Functions ¶
Types ¶
type Admin ¶
type Admin struct {
// 主键ID
ID int64 `json:"id"`
// 管理员名称
Username string `json:"username"`
// 密码
HashedPassword string `json:"hashed_password"`
// 是否激活,默认:否
IsActive bool `json:"is_active"`
// 角色ID,默认:2
RoleID int64 `json:"role_id"`
// 创建时间
CreatedAt time.Time `json:"created_at"`
// 更新时间
UpdatedAt time.Time `json:"updated_at"`
}
管理员账号表
type Article ¶
type Article struct {
ID uuid.UUID `json:"id"`
// 标题
Title string `json:"title"`
// 摘要
Summary string `json:"summary"`
// 内容
Content string `json:"content"`
// 浏览量
Views int32 `json:"views"`
// 点赞数
Likes int32 `json:"likes"`
// 是否发布
IsPublish bool `json:"is_publish"`
// 拥有者
Owner uuid.UUID `json:"owner"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
CategoryID int64 `json:"category_id"`
// 短标识
Slug pgtype.Text `json:"slug"`
// 封面
Cover string `json:"cover"`
// 最后更新时间
LastUpdated time.Time `json:"last_updated"`
// 检查过时
CheckOutdated bool `json:"check_outdated"`
// 阅读时间
ReadTime string `json:"read_time"`
}
type Category ¶
type Category struct {
ID int64 `json:"id"`
// 分类名称
Name string `json:"name"`
// 是否为系统分类
IsSystem bool `json:"is_system"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
文章分类表
type Comment ¶
type Comment struct {
ID int64 `json:"id"`
// 评论内容
Content string `json:"content"`
// 文章ID
ArticleID uuid.UUID `json:"article_id"`
// 父评论ID
ParentID int64 `json:"parent_id"`
Likes int32 `json:"likes"`
// 评论人ID
FromUserID uuid.UUID `json:"from_user_id"`
// 被评论人ID
ToUserID uuid.UUID `json:"to_user_id"`
CreatedAt time.Time `json:"created_at"`
DeletedAt time.Time `json:"deleted_at"`
}
type CountArticlesParams ¶
type CountSearchArticlesParams ¶ added in v1.2.1
type CreateAdminParams ¶
type CreateArticleParams ¶
type CreateCategoryTxParams ¶ added in v1.3.0
CreateCategoryTxParams contains the input parameters of the create category transaction
type CreateCategoryTxResult ¶ added in v1.3.0
type CreateCategoryTxResult struct {
Category Category
}
CreateCategoryTxResult is the result of the create category transaction
type CreateCommentParams ¶
type CreateSessionParams ¶
type CreateUserParams ¶
type CreateUserTxParams ¶
type CreateUserTxParams struct {
CreateUserParams
AfterCreate func(user User) error
}
CreateUserTxParams contains the input parameters of the transfer transaction
type CreateUserTxResult ¶
type CreateUserTxResult struct {
User User
}
CreateUserTxResult is the result of the transfer transaction
type CreateVerifyEmailParams ¶
type DeleteArticleTxParams ¶
DeleteArticleTxParams contains the input parameters of the transfer transaction
type DeleteCategoryTxParams ¶ added in v1.3.0
type GetArticleBySlugRow ¶ added in v1.3.0
type GetArticleBySlugRow struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
Summary string `json:"summary"`
Content string `json:"content"`
IsPublish bool `json:"is_publish"`
Views int32 `json:"views"`
Likes int32 `json:"likes"`
Cover string `json:"cover"`
Slug pgtype.Text `json:"slug"`
CheckOutdated bool `json:"check_outdated"`
LastUpdated time.Time `json:"last_updated"`
ReadTime string `json:"read_time"`
Owner uuid.UUID `json:"owner"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
CategoryID int64 `json:"category_id"`
CategoryName pgtype.Text `json:"category_name"`
}
type GetArticleForUpdateRow ¶ added in v1.3.0
type GetArticleForUpdateRow struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
Summary string `json:"summary"`
Content string `json:"content"`
Views int32 `json:"views"`
Likes int32 `json:"likes"`
IsPublish bool `json:"is_publish"`
Owner uuid.UUID `json:"owner"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
CategoryID int64 `json:"category_id"`
}
type GetArticleRow ¶
type GetArticleRow struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
Summary string `json:"summary"`
Content string `json:"content"`
IsPublish bool `json:"is_publish"`
Views int32 `json:"views"`
Likes int32 `json:"likes"`
Cover string `json:"cover"`
Slug pgtype.Text `json:"slug"`
CheckOutdated bool `json:"check_outdated"`
LastUpdated time.Time `json:"last_updated"`
ReadTime string `json:"read_time"`
Owner uuid.UUID `json:"owner"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
CategoryID int64 `json:"category_id"`
CategoryName pgtype.Text `json:"category_name"`
}
type ListAllArticlesParams ¶
type ListAllArticlesRow ¶
type ListAllArticlesRow struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
Summary string `json:"summary"`
Views int32 `json:"views"`
Likes int32 `json:"likes"`
IsPublish bool `json:"is_publish"`
Cover string `json:"cover"`
Slug pgtype.Text `json:"slug"`
CheckOutdated bool `json:"check_outdated"`
LastUpdated time.Time `json:"last_updated"`
ReadTime string `json:"read_time"`
Owner uuid.UUID `json:"owner"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
CategoryName pgtype.Text `json:"category_name"`
}
type ListArticlesByCategoryIDRow ¶
type ListArticlesByCategoryIDRow struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
Summary string `json:"summary"`
Views int32 `json:"views"`
Likes int32 `json:"likes"`
IsPublish bool `json:"is_publish"`
Owner uuid.UUID `json:"owner"`
CategoryID int64 `json:"category_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
Name pgtype.Text `json:"name"`
Username pgtype.Text `json:"username"`
}
type ListArticlesParams ¶
type ListArticlesRow ¶
type ListArticlesRow struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
Summary string `json:"summary"`
Views int32 `json:"views"`
Likes int32 `json:"likes"`
IsPublish bool `json:"is_publish"`
Cover string `json:"cover"`
Slug pgtype.Text `json:"slug"`
CheckOutdated bool `json:"check_outdated"`
LastUpdated time.Time `json:"last_updated"`
ReadTime string `json:"read_time"`
Owner uuid.UUID `json:"owner"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
CategoryName pgtype.Text `json:"category_name"`
Username pgtype.Text `json:"username"`
}
type ListCommentsByArticleIDRow ¶
type ListCommentsByArticleIDRow struct {
ID int64 `json:"id"`
Content string `json:"content"`
ArticleID uuid.UUID `json:"article_id"`
ParentID int64 `json:"parent_id"`
Likes int32 `json:"likes"`
FromUserID uuid.UUID `json:"from_user_id"`
ToUserID uuid.UUID `json:"to_user_id"`
CreatedAt time.Time `json:"created_at"`
DeletedAt time.Time `json:"deleted_at"`
FromUserName pgtype.Text `json:"from_user_name"`
ToUserName pgtype.Text `json:"to_user_name"`
}
type ListInitSysMenusRow ¶
type Querier ¶
type Querier interface {
AddCommentLikes(ctx context.Context, id int64) (Comment, error)
CountAllArticles(ctx context.Context) (int64, error)
CountArticles(ctx context.Context, arg CountArticlesParams) (int64, error)
CountArticlesByCategoryID(ctx context.Context, categoryID int64) (int64, error)
CountCategories(ctx context.Context) (int64, error)
CountSearchArticles(ctx context.Context, arg CountSearchArticlesParams) (int64, error)
CreateAdmin(ctx context.Context, arg CreateAdminParams) (Admin, error)
CreateArticle(ctx context.Context, arg CreateArticleParams) (Article, error)
CreateCategory(ctx context.Context, name string) (Category, error)
CreateComment(ctx context.Context, arg CreateCommentParams) (Comment, error)
CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
CreateVerifyEmail(ctx context.Context, arg CreateVerifyEmailParams) (VerifyEmail, error)
DeleteArticle(ctx context.Context, id uuid.UUID) error
DeleteCategory(ctx context.Context, id int64) error
DeleteChildComments(ctx context.Context, parentID int64) error
DeleteComment(ctx context.Context, id int64) error
DeleteCommentsByArticleID(ctx context.Context, articleID uuid.UUID) error
GetAdmin(ctx context.Context, username string) (Admin, error)
GetAdminById(ctx context.Context, id int64) (Admin, error)
GetArticle(ctx context.Context, id uuid.UUID) (GetArticleRow, error)
GetArticleBySlug(ctx context.Context, slug pgtype.Text) (GetArticleBySlugRow, error)
GetArticleForUpdate(ctx context.Context, id uuid.UUID) (GetArticleForUpdateRow, error)
GetCategory(ctx context.Context, id int64) (Category, error)
GetCategoryByName(ctx context.Context, name string) (Category, error)
GetComment(ctx context.Context, id int64) (Comment, error)
GetSession(ctx context.Context, id uuid.UUID) (Session, error)
GetUser(ctx context.Context, id uuid.UUID) (User, error)
GetUserByUsername(ctx context.Context, username string) (User, error)
IncrementArticleLikes(ctx context.Context, id uuid.UUID) error
IncrementArticleViews(ctx context.Context, id uuid.UUID) error
ListAllArticles(ctx context.Context, arg ListAllArticlesParams) ([]ListAllArticlesRow, error)
ListAllCategories(ctx context.Context) ([]Category, error)
ListArticles(ctx context.Context, arg ListArticlesParams) ([]ListArticlesRow, error)
ListArticlesByCategoryID(ctx context.Context, arg ListArticlesByCategoryIDParams) ([]ListArticlesByCategoryIDRow, error)
ListCategoriesCountArticles(ctx context.Context) ([]ListCategoriesCountArticlesRow, error)
ListCommentsByArticleID(ctx context.Context, articleID uuid.UUID) ([]ListCommentsByArticleIDRow, error)
ListInitSysMenus(ctx context.Context, roleID int64) ([]ListInitSysMenusRow, error)
SearchArticles(ctx context.Context, arg SearchArticlesParams) ([]SearchArticlesRow, error)
SetArticleDefaultCategoryIdByCategoryId(ctx context.Context, categoryID int64) error
UpdateAdmin(ctx context.Context, arg UpdateAdminParams) (Admin, error)
UpdateArticle(ctx context.Context, arg UpdateArticleParams) (Article, error)
UpdateCategory(ctx context.Context, arg UpdateCategoryParams) (Category, error)
UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)
UpdateVerifyEmail(ctx context.Context, arg UpdateVerifyEmailParams) (VerifyEmail, error)
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AddCommentLikes ¶
func (*Queries) CountAllArticles ¶
func (*Queries) CountArticles ¶
func (*Queries) CountArticlesByCategoryID ¶
func (*Queries) CountCategories ¶
func (*Queries) CountSearchArticles ¶ added in v1.2.1
func (*Queries) CreateAdmin ¶
func (*Queries) CreateArticle ¶
func (*Queries) CreateCategory ¶
func (*Queries) CreateComment ¶
func (*Queries) CreateSession ¶
func (*Queries) CreateUser ¶
func (*Queries) CreateVerifyEmail ¶
func (q *Queries) CreateVerifyEmail(ctx context.Context, arg CreateVerifyEmailParams) (VerifyEmail, error)
func (*Queries) DeleteArticle ¶
func (*Queries) DeleteCategory ¶
func (*Queries) DeleteChildComments ¶
func (*Queries) DeleteComment ¶
func (*Queries) DeleteCommentsByArticleID ¶
func (*Queries) GetAdminById ¶
func (*Queries) GetArticle ¶
func (*Queries) GetArticleBySlug ¶ added in v1.3.0
func (*Queries) GetArticleForUpdate ¶
func (*Queries) GetCategory ¶
func (*Queries) GetCategoryByName ¶
func (*Queries) GetComment ¶
func (*Queries) GetSession ¶
func (*Queries) GetUserByUsername ¶
func (*Queries) IncrementArticleLikes ¶
func (*Queries) IncrementArticleViews ¶
func (*Queries) ListAllArticles ¶
func (q *Queries) ListAllArticles(ctx context.Context, arg ListAllArticlesParams) ([]ListAllArticlesRow, error)
func (*Queries) ListAllCategories ¶
func (*Queries) ListArticles ¶
func (q *Queries) ListArticles(ctx context.Context, arg ListArticlesParams) ([]ListArticlesRow, error)
func (*Queries) ListArticlesByCategoryID ¶
func (q *Queries) ListArticlesByCategoryID(ctx context.Context, arg ListArticlesByCategoryIDParams) ([]ListArticlesByCategoryIDRow, error)
func (*Queries) ListCategoriesCountArticles ¶
func (q *Queries) ListCategoriesCountArticles(ctx context.Context) ([]ListCategoriesCountArticlesRow, error)
func (*Queries) ListCommentsByArticleID ¶
func (*Queries) ListInitSysMenus ¶
func (*Queries) SearchArticles ¶ added in v1.2.1
func (q *Queries) SearchArticles(ctx context.Context, arg SearchArticlesParams) ([]SearchArticlesRow, error)
func (*Queries) SetArticleDefaultCategoryIdByCategoryId ¶
func (*Queries) UpdateAdmin ¶
func (*Queries) UpdateArticle ¶
func (*Queries) UpdateCategory ¶
func (*Queries) UpdateUser ¶
func (*Queries) UpdateVerifyEmail ¶
func (q *Queries) UpdateVerifyEmail(ctx context.Context, arg UpdateVerifyEmailParams) (VerifyEmail, error)
type Role ¶
type Role struct {
// 主键ID
ID int64 `json:"id"`
// 角色名称
RoleName string `json:"role_name"`
// 角色描述
Description string `json:"description"`
// 是否为系统角色
IsSystem bool `json:"is_system"`
// 创建时间
CreatedAt time.Time `json:"created_at"`
}
角色表
type RolePermission ¶
type RolePermission struct {
// 主键ID
ID int64 `json:"id"`
// 角色ID
RoleID int64 `json:"role_id"`
// 菜单ID
MenuID int64 `json:"menu_id"`
// 创建人ID
CreatedBy int64 `json:"created_by"`
// 创建时间
CreatedAt time.Time `json:"created_at"`
}
角色权限表
type SQLStore ¶
type SQLStore struct {
*Queries
// contains filtered or unexported fields
}
SQLStore provides all functions to execute SQL queries and transactions
func (*SQLStore) CreateCategoryTx ¶ added in v1.3.0
func (store *SQLStore) CreateCategoryTx(ctx context.Context, arg CreateCategoryTxParams) (CreateCategoryTxResult, error)
func (*SQLStore) CreateUserTx ¶
func (store *SQLStore) CreateUserTx(ctx context.Context, arg CreateUserTxParams) (CreateUserTxResult, error)
CreateUserTx performs a money transfer from on account to the other It creates a transfer record, add account entries, and update account's balance within a single database transaction
func (*SQLStore) DeleteArticleTx ¶
func (store *SQLStore) DeleteArticleTx(ctx context.Context, arg DeleteArticleTxParams) error
func (*SQLStore) DeleteCategoryTx ¶
func (store *SQLStore) DeleteCategoryTx(ctx context.Context, arg DeleteCategoryTxParams) error
func (*SQLStore) UpdateArticleTx ¶
func (store *SQLStore) UpdateArticleTx(ctx context.Context, arg UpdateArticleTxParams) (UpdateArticleTxResult, error)
func (*SQLStore) UpdateCategoryTx ¶ added in v1.3.0
func (store *SQLStore) UpdateCategoryTx(ctx context.Context, arg UpdateCategoryTxParams) (UpdateCategoryTxResult, error)
func (*SQLStore) VerifyEmailTx ¶
func (store *SQLStore) VerifyEmailTx(ctx context.Context, arg VerifyEmailTxParams) (VerifyEmailTxResult, error)
VerifyEmailTx performs a money transfer from on account to the other It creates a transfer record, add account entries, and update account's balance within a single database transaction
type SearchArticlesParams ¶ added in v1.2.1
type SearchArticlesRow ¶ added in v1.2.1
type SearchArticlesRow struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
Summary string `json:"summary"`
Views int32 `json:"views"`
Likes int32 `json:"likes"`
IsPublish bool `json:"is_publish"`
Cover string `json:"cover"`
Slug pgtype.Text `json:"slug"`
CheckOutdated bool `json:"check_outdated"`
LastUpdated time.Time `json:"last_updated"`
ReadTime string `json:"read_time"`
Owner uuid.UUID `json:"owner"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
CategoryName pgtype.Text `json:"category_name"`
Username pgtype.Text `json:"username"`
Score interface{} `json:"score"`
}
type Session ¶
type Session struct {
ID uuid.UUID `json:"id"`
UserID uuid.UUID `json:"user_id"`
RefreshToken string `json:"refresh_token"`
UserAgent string `json:"user_agent"`
ClientIp string `json:"client_ip"`
IsBlocked bool `json:"is_blocked"`
ExpiresAt time.Time `json:"expires_at"`
CreatedAt time.Time `json:"created_at"`
}
type Store ¶
type Store interface {
Querier
CreateUserTx(ctx context.Context, arg CreateUserTxParams) (CreateUserTxResult, error)
VerifyEmailTx(ctx context.Context, arg VerifyEmailTxParams) (VerifyEmailTxResult, error)
UpdateArticleTx(ctx context.Context, arg UpdateArticleTxParams) (UpdateArticleTxResult, error)
DeleteArticleTx(ctx context.Context, arg DeleteArticleTxParams) error
DeleteCategoryTx(ctx context.Context, arg DeleteCategoryTxParams) error
UpdateCategoryTx(ctx context.Context, arg UpdateCategoryTxParams) (UpdateCategoryTxResult, error)
CreateCategoryTx(ctx context.Context, arg CreateCategoryTxParams) (CreateCategoryTxResult, error)
}
Store provides all functions to execute db queries and transactions
type SysMenu ¶
type SysMenu struct {
// 主键ID
ID int64 `json:"id"`
// 菜单名称
Name string `json:"name"`
// 菜单路径
Path string `json:"path"`
// 菜单图标
Icon string `json:"icon"`
// 是否激活,默认:否
IsActive bool `json:"is_active"`
// 1:目录;2:菜单;3:按钮(事件)
Type int32 `json:"type"`
// 排序编号
Sort int32 `json:"sort"`
// 父菜单ID
ParentID pgtype.Int8 `json:"parent_id"`
// 创建时间
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
后台系统菜单表
type UpdateAdminParams ¶
type UpdateArticleParams ¶
type UpdateArticleParams struct {
Title pgtype.Text `json:"title"`
Summary pgtype.Text `json:"summary"`
Content pgtype.Text `json:"content"`
IsPublish pgtype.Bool `json:"is_publish"`
CategoryID pgtype.Int8 `json:"category_id"`
Cover pgtype.Text `json:"cover"`
Slug pgtype.Text `json:"slug"`
CheckOutdated pgtype.Bool `json:"check_outdated"`
LastUpdated pgtype.Timestamptz `json:"last_updated"`
ReadTime pgtype.Text `json:"read_time"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
ID uuid.UUID `json:"id"`
}
type UpdateArticleTxParams ¶
type UpdateArticleTxParams struct {
UpdateArticleParams
AfterUpdate func(article Article) error
}
UpdateArticleTxParams contains the input parameters of the transfer transaction
type UpdateArticleTxResult ¶
type UpdateArticleTxResult struct {
Article Article
}
UpdateArticleTxResult is the result of the transfer transaction
type UpdateCategoryParams ¶
type UpdateCategoryTxParams ¶ added in v1.3.0
type UpdateCategoryTxParams struct {
UpdateCategoryParams
AfterUpdate func() error
}
type UpdateCategoryTxResult ¶ added in v1.3.0
type UpdateCategoryTxResult struct {
Category Category
}
type UpdateUserParams ¶
type UpdateVerifyEmailParams ¶
type User ¶
type User struct {
ID uuid.UUID `json:"id"`
Username string `json:"username"`
HashedPassword string `json:"hashed_password"`
FullName string `json:"full_name"`
Email string `json:"email"`
IsEmailVerified bool `json:"is_email_verified"`
// 介绍
About string `json:"about"`
Role string `json:"role"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
}
type VerifyEmail ¶
type VerifyEmailTxParams ¶
VerifyEmailTxParams contains the input parameters of the transfer transaction
type VerifyEmailTxResult ¶
type VerifyEmailTxResult struct {
User User
VerifyEmail VerifyEmail
}
VerifyEmailTxResult is the result of the transfer transaction
Source Files
¶
- admin.sql.go
- article.sql.go
- category.sql.go
- comment.sql.go
- db.go
- error.go
- exec_tx.go
- models.go
- querier.go
- session.sql.go
- store.go
- sys_menu.sql.go
- tx_create_category.go
- tx_create_user.go
- tx_delete_article.go
- tx_delete_category.go
- tx_update_article.go
- tx_update_category.go
- tx_verify_email.go
- user.sql.go
- verify_email.sql.go