初始化项目框架,完成部分接口开发
This commit is contained in:
27
internal/dao/admins.go
Normal file
27
internal/dao/admins.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalAdminsDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalAdminsDao = *internal.AdminsDao
|
||||
|
||||
// adminsDao is the data access object for the table admins.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type adminsDao struct {
|
||||
internalAdminsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Admins is a globally accessible object for table admins operations.
|
||||
Admins = adminsDao{
|
||||
internal.NewAdminsDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/authors.go
Normal file
27
internal/dao/authors.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalAuthorsDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalAuthorsDao = *internal.AuthorsDao
|
||||
|
||||
// authorsDao is the data access object for the table authors.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type authorsDao struct {
|
||||
internalAuthorsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Authors is a globally accessible object for table authors operations.
|
||||
Authors = authorsDao{
|
||||
internal.NewAuthorsDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/book_ratings.go
Normal file
27
internal/dao/book_ratings.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalBookRatingsDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalBookRatingsDao = *internal.BookRatingsDao
|
||||
|
||||
// bookRatingsDao is the data access object for the table book_ratings.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type bookRatingsDao struct {
|
||||
internalBookRatingsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// BookRatings is a globally accessible object for table book_ratings operations.
|
||||
BookRatings = bookRatingsDao{
|
||||
internal.NewBookRatingsDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/books.go
Normal file
27
internal/dao/books.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalBooksDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalBooksDao = *internal.BooksDao
|
||||
|
||||
// booksDao is the data access object for the table books.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type booksDao struct {
|
||||
internalBooksDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Books is a globally accessible object for table books operations.
|
||||
Books = booksDao{
|
||||
internal.NewBooksDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/bookshelves.go
Normal file
27
internal/dao/bookshelves.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalBookshelvesDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalBookshelvesDao = *internal.BookshelvesDao
|
||||
|
||||
// bookshelvesDao is the data access object for the table bookshelves.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type bookshelvesDao struct {
|
||||
internalBookshelvesDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Bookshelves is a globally accessible object for table bookshelves operations.
|
||||
Bookshelves = bookshelvesDao{
|
||||
internal.NewBookshelvesDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/categories.go
Normal file
27
internal/dao/categories.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalCategoriesDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalCategoriesDao = *internal.CategoriesDao
|
||||
|
||||
// categoriesDao is the data access object for the table categories.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type categoriesDao struct {
|
||||
internalCategoriesDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Categories is a globally accessible object for table categories operations.
|
||||
Categories = categoriesDao{
|
||||
internal.NewCategoriesDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/chapters.go
Normal file
27
internal/dao/chapters.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalChaptersDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalChaptersDao = *internal.ChaptersDao
|
||||
|
||||
// chaptersDao is the data access object for the table chapters.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type chaptersDao struct {
|
||||
internalChaptersDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Chapters is a globally accessible object for table chapters operations.
|
||||
Chapters = chaptersDao{
|
||||
internal.NewChaptersDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/feedbacks.go
Normal file
27
internal/dao/feedbacks.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalFeedbacksDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalFeedbacksDao = *internal.FeedbacksDao
|
||||
|
||||
// feedbacksDao is the data access object for the table feedbacks.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type feedbacksDao struct {
|
||||
internalFeedbacksDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Feedbacks is a globally accessible object for table feedbacks operations.
|
||||
Feedbacks = feedbacksDao{
|
||||
internal.NewFeedbacksDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
83
internal/dao/internal/admins.go
Normal file
83
internal/dao/internal/admins.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// AdminsDao is the data access object for the table admins.
|
||||
type AdminsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns AdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminsColumns defines and stores column names for the table admins.
|
||||
type AdminsColumns struct {
|
||||
Id string // 管理员ID
|
||||
Username string // 管理员用户名
|
||||
PasswordHash string // 密码哈希
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
}
|
||||
|
||||
// adminsColumns holds the columns for the table admins.
|
||||
var adminsColumns = AdminsColumns{
|
||||
Id: "id",
|
||||
Username: "username",
|
||||
PasswordHash: "password_hash",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewAdminsDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminsDao() *AdminsDao {
|
||||
return &AdminsDao{
|
||||
group: "default",
|
||||
table: "admins",
|
||||
columns: adminsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *AdminsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *AdminsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *AdminsDao) Columns() AdminsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *AdminsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *AdminsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *AdminsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
87
internal/dao/internal/authors.go
Normal file
87
internal/dao/internal/authors.go
Normal file
@ -0,0 +1,87 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// AuthorsDao is the data access object for the table authors.
|
||||
type AuthorsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns AuthorsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AuthorsColumns defines and stores column names for the table authors.
|
||||
type AuthorsColumns struct {
|
||||
Id string // 作者ID
|
||||
UserId string // 用户ID
|
||||
PenName string // 笔名
|
||||
Bio string // 作者简介
|
||||
Status string // 状态:1=正常,2=禁用
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
}
|
||||
|
||||
// authorsColumns holds the columns for the table authors.
|
||||
var authorsColumns = AuthorsColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
PenName: "pen_name",
|
||||
Bio: "bio",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewAuthorsDao creates and returns a new DAO object for table data access.
|
||||
func NewAuthorsDao() *AuthorsDao {
|
||||
return &AuthorsDao{
|
||||
group: "default",
|
||||
table: "authors",
|
||||
columns: authorsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *AuthorsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *AuthorsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *AuthorsDao) Columns() AuthorsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *AuthorsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *AuthorsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *AuthorsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
83
internal/dao/internal/book_ratings.go
Normal file
83
internal/dao/internal/book_ratings.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// BookRatingsDao is the data access object for the table book_ratings.
|
||||
type BookRatingsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns BookRatingsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// BookRatingsColumns defines and stores column names for the table book_ratings.
|
||||
type BookRatingsColumns struct {
|
||||
Id string // 评分ID
|
||||
UserId string // 用户ID
|
||||
BookId string // 小说ID
|
||||
Score string // 评分(0~10)
|
||||
Comment string // 用户评论
|
||||
CreatedAt string // 创建时间
|
||||
}
|
||||
|
||||
// bookRatingsColumns holds the columns for the table book_ratings.
|
||||
var bookRatingsColumns = BookRatingsColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
BookId: "book_id",
|
||||
Score: "score",
|
||||
Comment: "comment",
|
||||
CreatedAt: "created_at",
|
||||
}
|
||||
|
||||
// NewBookRatingsDao creates and returns a new DAO object for table data access.
|
||||
func NewBookRatingsDao() *BookRatingsDao {
|
||||
return &BookRatingsDao{
|
||||
group: "default",
|
||||
table: "book_ratings",
|
||||
columns: bookRatingsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *BookRatingsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *BookRatingsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *BookRatingsDao) Columns() BookRatingsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *BookRatingsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *BookRatingsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *BookRatingsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
105
internal/dao/internal/books.go
Normal file
105
internal/dao/internal/books.go
Normal file
@ -0,0 +1,105 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// BooksDao is the data access object for the table books.
|
||||
type BooksDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns BooksColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// BooksColumns defines and stores column names for the table books.
|
||||
type BooksColumns struct {
|
||||
Id string // 小说ID
|
||||
AuthorId string // 作者ID
|
||||
CategoryId string // 分类ID
|
||||
Title string // 小说标题
|
||||
CoverUrl string // 封面图片URL
|
||||
Description string // 小说简介
|
||||
Status string // 状态:1=连载中,2=完结,3=下架
|
||||
WordsCount string // 字数
|
||||
ChaptersCount string // 章节数
|
||||
LatestChapterId string // 最新章节ID
|
||||
Rating string // 评分(0.00~10.00)
|
||||
ReadCount string // 阅读人数
|
||||
Tags string // 标签(逗号分隔)
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
IsRecommended string // 是否推荐:0=否,1=是
|
||||
}
|
||||
|
||||
// booksColumns holds the columns for the table books.
|
||||
var booksColumns = BooksColumns{
|
||||
Id: "id",
|
||||
AuthorId: "author_id",
|
||||
CategoryId: "category_id",
|
||||
Title: "title",
|
||||
CoverUrl: "cover_url",
|
||||
Description: "description",
|
||||
Status: "status",
|
||||
WordsCount: "words_count",
|
||||
ChaptersCount: "chapters_count",
|
||||
LatestChapterId: "latest_chapter_id",
|
||||
Rating: "rating",
|
||||
ReadCount: "read_count",
|
||||
Tags: "tags",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
IsRecommended: "is_recommended",
|
||||
}
|
||||
|
||||
// NewBooksDao creates and returns a new DAO object for table data access.
|
||||
func NewBooksDao() *BooksDao {
|
||||
return &BooksDao{
|
||||
group: "default",
|
||||
table: "books",
|
||||
columns: booksColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *BooksDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *BooksDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *BooksDao) Columns() BooksColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *BooksDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *BooksDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *BooksDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
85
internal/dao/internal/bookshelves.go
Normal file
85
internal/dao/internal/bookshelves.go
Normal file
@ -0,0 +1,85 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// BookshelvesDao is the data access object for the table bookshelves.
|
||||
type BookshelvesDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns BookshelvesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// BookshelvesColumns defines and stores column names for the table bookshelves.
|
||||
type BookshelvesColumns struct {
|
||||
Id string // 记录ID
|
||||
UserId string // 用户ID
|
||||
BookId string // 小说ID
|
||||
AddedAt string // 加入书架时间
|
||||
LastReadChapterId string // 最后阅读章节ID
|
||||
LastReadPercent string // 阅读进度百分比(0.00~100.00)
|
||||
LastReadAt string // 最后阅读时间
|
||||
}
|
||||
|
||||
// bookshelvesColumns holds the columns for the table bookshelves.
|
||||
var bookshelvesColumns = BookshelvesColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
BookId: "book_id",
|
||||
AddedAt: "added_at",
|
||||
LastReadChapterId: "last_read_chapter_id",
|
||||
LastReadPercent: "last_read_percent",
|
||||
LastReadAt: "last_read_at",
|
||||
}
|
||||
|
||||
// NewBookshelvesDao creates and returns a new DAO object for table data access.
|
||||
func NewBookshelvesDao() *BookshelvesDao {
|
||||
return &BookshelvesDao{
|
||||
group: "default",
|
||||
table: "bookshelves",
|
||||
columns: bookshelvesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *BookshelvesDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *BookshelvesDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *BookshelvesDao) Columns() BookshelvesColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *BookshelvesDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *BookshelvesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *BookshelvesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
83
internal/dao/internal/categories.go
Normal file
83
internal/dao/internal/categories.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// CategoriesDao is the data access object for the table categories.
|
||||
type CategoriesDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns CategoriesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// CategoriesColumns defines and stores column names for the table categories.
|
||||
type CategoriesColumns struct {
|
||||
Id string // 分类ID
|
||||
Name string // 分类名称
|
||||
Type string // 分类类型:1=男频, 2=女频
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
}
|
||||
|
||||
// categoriesColumns holds the columns for the table categories.
|
||||
var categoriesColumns = CategoriesColumns{
|
||||
Id: "id",
|
||||
Name: "name",
|
||||
Type: "type",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewCategoriesDao creates and returns a new DAO object for table data access.
|
||||
func NewCategoriesDao() *CategoriesDao {
|
||||
return &CategoriesDao{
|
||||
group: "default",
|
||||
table: "categories",
|
||||
columns: categoriesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *CategoriesDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *CategoriesDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *CategoriesDao) Columns() CategoriesColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *CategoriesDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *CategoriesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *CategoriesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
93
internal/dao/internal/chapters.go
Normal file
93
internal/dao/internal/chapters.go
Normal file
@ -0,0 +1,93 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ChaptersDao is the data access object for the table chapters.
|
||||
type ChaptersDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns ChaptersColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// ChaptersColumns defines and stores column names for the table chapters.
|
||||
type ChaptersColumns struct {
|
||||
Id string // 章节ID
|
||||
BookId string // 小说ID
|
||||
Title string // 章节标题
|
||||
Content string // 章节内容
|
||||
WordCount string // 章节字数
|
||||
Sort string // 排序序号
|
||||
IsLocked string // 是否锁定:0=免费,1=需积分解锁
|
||||
RequiredScore string // 解锁该章节所需积分
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
}
|
||||
|
||||
// chaptersColumns holds the columns for the table chapters.
|
||||
var chaptersColumns = ChaptersColumns{
|
||||
Id: "id",
|
||||
BookId: "book_id",
|
||||
Title: "title",
|
||||
Content: "content",
|
||||
WordCount: "word_count",
|
||||
Sort: "sort",
|
||||
IsLocked: "is_locked",
|
||||
RequiredScore: "required_score",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewChaptersDao creates and returns a new DAO object for table data access.
|
||||
func NewChaptersDao() *ChaptersDao {
|
||||
return &ChaptersDao{
|
||||
group: "default",
|
||||
table: "chapters",
|
||||
columns: chaptersColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *ChaptersDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *ChaptersDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *ChaptersDao) Columns() ChaptersColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *ChaptersDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *ChaptersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *ChaptersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
83
internal/dao/internal/feedbacks.go
Normal file
83
internal/dao/internal/feedbacks.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// FeedbacksDao is the data access object for the table feedbacks.
|
||||
type FeedbacksDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns FeedbacksColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// FeedbacksColumns defines and stores column names for the table feedbacks.
|
||||
type FeedbacksColumns struct {
|
||||
Id string // 反馈ID
|
||||
UserId string // 用户ID
|
||||
Content string // 反馈内容
|
||||
Status string // 处理状态:1=未处理,2=处理中,3=已处理
|
||||
CreatedAt string // 反馈时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// feedbacksColumns holds the columns for the table feedbacks.
|
||||
var feedbacksColumns = FeedbacksColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
Content: "content",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewFeedbacksDao creates and returns a new DAO object for table data access.
|
||||
func NewFeedbacksDao() *FeedbacksDao {
|
||||
return &FeedbacksDao{
|
||||
group: "default",
|
||||
table: "feedbacks",
|
||||
columns: feedbacksColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *FeedbacksDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *FeedbacksDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *FeedbacksDao) Columns() FeedbacksColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *FeedbacksDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *FeedbacksDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *FeedbacksDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
81
internal/dao/internal/read_records.go
Normal file
81
internal/dao/internal/read_records.go
Normal file
@ -0,0 +1,81 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ReadRecordsDao is the data access object for the table read_records.
|
||||
type ReadRecordsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns ReadRecordsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// ReadRecordsColumns defines and stores column names for the table read_records.
|
||||
type ReadRecordsColumns struct {
|
||||
Id string // 记录ID
|
||||
UserId string // 用户ID
|
||||
BookId string // 小说ID
|
||||
ChapterId string // 章节ID
|
||||
ReadAt string // 阅读时间
|
||||
}
|
||||
|
||||
// readRecordsColumns holds the columns for the table read_records.
|
||||
var readRecordsColumns = ReadRecordsColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
BookId: "book_id",
|
||||
ChapterId: "chapter_id",
|
||||
ReadAt: "read_at",
|
||||
}
|
||||
|
||||
// NewReadRecordsDao creates and returns a new DAO object for table data access.
|
||||
func NewReadRecordsDao() *ReadRecordsDao {
|
||||
return &ReadRecordsDao{
|
||||
group: "default",
|
||||
table: "read_records",
|
||||
columns: readRecordsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *ReadRecordsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *ReadRecordsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *ReadRecordsDao) Columns() ReadRecordsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *ReadRecordsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *ReadRecordsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *ReadRecordsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
83
internal/dao/internal/tags.go
Normal file
83
internal/dao/internal/tags.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// TagsDao is the data access object for the table tags.
|
||||
type TagsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns TagsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// TagsColumns defines and stores column names for the table tags.
|
||||
type TagsColumns struct {
|
||||
Id string // 标签ID
|
||||
Name string // 标签名称
|
||||
Type string // 标签类型:1=主题, 2=角色, 3=情节
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
}
|
||||
|
||||
// tagsColumns holds the columns for the table tags.
|
||||
var tagsColumns = TagsColumns{
|
||||
Id: "id",
|
||||
Name: "name",
|
||||
Type: "type",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewTagsDao creates and returns a new DAO object for table data access.
|
||||
func NewTagsDao() *TagsDao {
|
||||
return &TagsDao{
|
||||
group: "default",
|
||||
table: "tags",
|
||||
columns: tagsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *TagsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *TagsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *TagsDao) Columns() TagsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *TagsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *TagsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *TagsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
83
internal/dao/internal/user_chapter_purchases.go
Normal file
83
internal/dao/internal/user_chapter_purchases.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// UserChapterPurchasesDao is the data access object for the table user_chapter_purchases.
|
||||
type UserChapterPurchasesDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserChapterPurchasesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// UserChapterPurchasesColumns defines and stores column names for the table user_chapter_purchases.
|
||||
type UserChapterPurchasesColumns struct {
|
||||
Id string // 购买记录ID
|
||||
UserId string // 用户ID
|
||||
BookId string // 小说ID
|
||||
ChapterId string // 章节ID
|
||||
PointsUsed string // 消耗积分数
|
||||
PurchaseTime string // 购买时间
|
||||
}
|
||||
|
||||
// userChapterPurchasesColumns holds the columns for the table user_chapter_purchases.
|
||||
var userChapterPurchasesColumns = UserChapterPurchasesColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
BookId: "book_id",
|
||||
ChapterId: "chapter_id",
|
||||
PointsUsed: "points_used",
|
||||
PurchaseTime: "purchase_time",
|
||||
}
|
||||
|
||||
// NewUserChapterPurchasesDao creates and returns a new DAO object for table data access.
|
||||
func NewUserChapterPurchasesDao() *UserChapterPurchasesDao {
|
||||
return &UserChapterPurchasesDao{
|
||||
group: "default",
|
||||
table: "user_chapter_purchases",
|
||||
columns: userChapterPurchasesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *UserChapterPurchasesDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *UserChapterPurchasesDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *UserChapterPurchasesDao) Columns() UserChapterPurchasesColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *UserChapterPurchasesDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UserChapterPurchasesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *UserChapterPurchasesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
79
internal/dao/internal/user_follow_authors.go
Normal file
79
internal/dao/internal/user_follow_authors.go
Normal file
@ -0,0 +1,79 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// UserFollowAuthorsDao is the data access object for the table user_follow_authors.
|
||||
type UserFollowAuthorsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserFollowAuthorsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// UserFollowAuthorsColumns defines and stores column names for the table user_follow_authors.
|
||||
type UserFollowAuthorsColumns struct {
|
||||
Id string // 关注ID
|
||||
UserId string // 用户ID
|
||||
AuthorId string // 作者ID
|
||||
FollowedAt string // 关注时间
|
||||
}
|
||||
|
||||
// userFollowAuthorsColumns holds the columns for the table user_follow_authors.
|
||||
var userFollowAuthorsColumns = UserFollowAuthorsColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
AuthorId: "author_id",
|
||||
FollowedAt: "followed_at",
|
||||
}
|
||||
|
||||
// NewUserFollowAuthorsDao creates and returns a new DAO object for table data access.
|
||||
func NewUserFollowAuthorsDao() *UserFollowAuthorsDao {
|
||||
return &UserFollowAuthorsDao{
|
||||
group: "default",
|
||||
table: "user_follow_authors",
|
||||
columns: userFollowAuthorsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *UserFollowAuthorsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *UserFollowAuthorsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *UserFollowAuthorsDao) Columns() UserFollowAuthorsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *UserFollowAuthorsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UserFollowAuthorsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *UserFollowAuthorsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
79
internal/dao/internal/user_points.go
Normal file
79
internal/dao/internal/user_points.go
Normal file
@ -0,0 +1,79 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// UserPointsDao is the data access object for the table user_points.
|
||||
type UserPointsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserPointsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// UserPointsColumns defines and stores column names for the table user_points.
|
||||
type UserPointsColumns struct {
|
||||
Id string // 积分账户ID
|
||||
UserId string // 用户ID
|
||||
PointsBalance string // 当前积分余额
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// userPointsColumns holds the columns for the table user_points.
|
||||
var userPointsColumns = UserPointsColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
PointsBalance: "points_balance",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewUserPointsDao creates and returns a new DAO object for table data access.
|
||||
func NewUserPointsDao() *UserPointsDao {
|
||||
return &UserPointsDao{
|
||||
group: "default",
|
||||
table: "user_points",
|
||||
columns: userPointsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *UserPointsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *UserPointsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *UserPointsDao) Columns() UserPointsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *UserPointsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UserPointsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *UserPointsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
85
internal/dao/internal/user_points_logs.go
Normal file
85
internal/dao/internal/user_points_logs.go
Normal file
@ -0,0 +1,85 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// UserPointsLogsDao is the data access object for the table user_points_logs.
|
||||
type UserPointsLogsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserPointsLogsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// UserPointsLogsColumns defines and stores column names for the table user_points_logs.
|
||||
type UserPointsLogsColumns struct {
|
||||
Id string // 积分流水ID
|
||||
UserId string // 用户ID
|
||||
ChangeType string // 变动类型,例如 earn、spend、refund 等
|
||||
PointsChange string // 积分变化数,正数增加,负数减少
|
||||
RelatedOrderId string // 关联订单ID
|
||||
Description string // 变动说明
|
||||
CreatedAt string // 变动时间
|
||||
}
|
||||
|
||||
// userPointsLogsColumns holds the columns for the table user_points_logs.
|
||||
var userPointsLogsColumns = UserPointsLogsColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
ChangeType: "change_type",
|
||||
PointsChange: "points_change",
|
||||
RelatedOrderId: "related_order_id",
|
||||
Description: "description",
|
||||
CreatedAt: "created_at",
|
||||
}
|
||||
|
||||
// NewUserPointsLogsDao creates and returns a new DAO object for table data access.
|
||||
func NewUserPointsLogsDao() *UserPointsLogsDao {
|
||||
return &UserPointsLogsDao{
|
||||
group: "default",
|
||||
table: "user_points_logs",
|
||||
columns: userPointsLogsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *UserPointsLogsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *UserPointsLogsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *UserPointsLogsDao) Columns() UserPointsLogsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *UserPointsLogsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UserPointsLogsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *UserPointsLogsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
89
internal/dao/internal/users.go
Normal file
89
internal/dao/internal/users.go
Normal file
@ -0,0 +1,89 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// UsersDao is the data access object for the table users.
|
||||
type UsersDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UsersColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// UsersColumns defines and stores column names for the table users.
|
||||
type UsersColumns struct {
|
||||
Id string // 用户ID
|
||||
Username string // 用户名
|
||||
PasswordHash string // 密码哈希
|
||||
Avatar string // 头像URL
|
||||
Email string // 邮箱
|
||||
Points string // 积分
|
||||
CreatedAt string // 注册时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
}
|
||||
|
||||
// usersColumns holds the columns for the table users.
|
||||
var usersColumns = UsersColumns{
|
||||
Id: "id",
|
||||
Username: "username",
|
||||
PasswordHash: "password_hash",
|
||||
Avatar: "avatar",
|
||||
Email: "email",
|
||||
Points: "points",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewUsersDao creates and returns a new DAO object for table data access.
|
||||
func NewUsersDao() *UsersDao {
|
||||
return &UsersDao{
|
||||
group: "default",
|
||||
table: "users",
|
||||
columns: usersColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *UsersDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *UsersDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *UsersDao) Columns() UsersColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *UsersDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UsersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *UsersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
27
internal/dao/read_records.go
Normal file
27
internal/dao/read_records.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalReadRecordsDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalReadRecordsDao = *internal.ReadRecordsDao
|
||||
|
||||
// readRecordsDao is the data access object for the table read_records.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type readRecordsDao struct {
|
||||
internalReadRecordsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// ReadRecords is a globally accessible object for table read_records operations.
|
||||
ReadRecords = readRecordsDao{
|
||||
internal.NewReadRecordsDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/tags.go
Normal file
27
internal/dao/tags.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalTagsDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalTagsDao = *internal.TagsDao
|
||||
|
||||
// tagsDao is the data access object for the table tags.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type tagsDao struct {
|
||||
internalTagsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Tags is a globally accessible object for table tags operations.
|
||||
Tags = tagsDao{
|
||||
internal.NewTagsDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/user_chapter_purchases.go
Normal file
27
internal/dao/user_chapter_purchases.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalUserChapterPurchasesDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalUserChapterPurchasesDao = *internal.UserChapterPurchasesDao
|
||||
|
||||
// userChapterPurchasesDao is the data access object for the table user_chapter_purchases.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type userChapterPurchasesDao struct {
|
||||
internalUserChapterPurchasesDao
|
||||
}
|
||||
|
||||
var (
|
||||
// UserChapterPurchases is a globally accessible object for table user_chapter_purchases operations.
|
||||
UserChapterPurchases = userChapterPurchasesDao{
|
||||
internal.NewUserChapterPurchasesDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/user_follow_authors.go
Normal file
27
internal/dao/user_follow_authors.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalUserFollowAuthorsDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalUserFollowAuthorsDao = *internal.UserFollowAuthorsDao
|
||||
|
||||
// userFollowAuthorsDao is the data access object for the table user_follow_authors.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type userFollowAuthorsDao struct {
|
||||
internalUserFollowAuthorsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// UserFollowAuthors is a globally accessible object for table user_follow_authors operations.
|
||||
UserFollowAuthors = userFollowAuthorsDao{
|
||||
internal.NewUserFollowAuthorsDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/user_points.go
Normal file
27
internal/dao/user_points.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalUserPointsDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalUserPointsDao = *internal.UserPointsDao
|
||||
|
||||
// userPointsDao is the data access object for the table user_points.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type userPointsDao struct {
|
||||
internalUserPointsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// UserPoints is a globally accessible object for table user_points operations.
|
||||
UserPoints = userPointsDao{
|
||||
internal.NewUserPointsDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/user_points_logs.go
Normal file
27
internal/dao/user_points_logs.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalUserPointsLogsDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalUserPointsLogsDao = *internal.UserPointsLogsDao
|
||||
|
||||
// userPointsLogsDao is the data access object for the table user_points_logs.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type userPointsLogsDao struct {
|
||||
internalUserPointsLogsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// UserPointsLogs is a globally accessible object for table user_points_logs operations.
|
||||
UserPointsLogs = userPointsLogsDao{
|
||||
internal.NewUserPointsLogsDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/users.go
Normal file
27
internal/dao/users.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalUsersDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalUsersDao = *internal.UsersDao
|
||||
|
||||
// usersDao is the data access object for the table users.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type usersDao struct {
|
||||
internalUsersDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Users is a globally accessible object for table users operations.
|
||||
Users = usersDao{
|
||||
internal.NewUsersDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
Reference in New Issue
Block a user