From 05ab1efa7b26e51a4855d1cc62d3fb020f20192c Mon Sep 17 00:00:00 2001 From: maziyang Date: Fri, 20 Jun 2025 11:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E5=AE=9E?= =?UTF-8?q?=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/internal/post.go | 87 ----------------------------- internal/dao/internal/remain_vote_number.go | 85 ---------------------------- internal/dao/post.go | 22 -------- internal/dao/remain_vote_number.go | 22 -------- internal/model/do/post.go | 20 ------- internal/model/do/remain_vote_number.go | 19 ------- internal/model/entity/post.go | 18 ------ internal/model/entity/remain_vote_number.go | 17 ------ 8 files changed, 290 deletions(-) delete mode 100644 internal/dao/internal/post.go delete mode 100644 internal/dao/internal/remain_vote_number.go delete mode 100644 internal/dao/post.go delete mode 100644 internal/dao/remain_vote_number.go delete mode 100644 internal/model/do/post.go delete mode 100644 internal/model/do/remain_vote_number.go delete mode 100644 internal/model/entity/post.go delete mode 100644 internal/model/entity/remain_vote_number.go diff --git a/internal/dao/internal/post.go b/internal/dao/internal/post.go deleted file mode 100644 index 6d9fe20..0000000 --- a/internal/dao/internal/post.go +++ /dev/null @@ -1,87 +0,0 @@ -// ========================================================================== -// 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" -) - -// PostDao is the data access object for the table post. -type PostDao 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 PostColumns // columns contains all the column names of Table for convenient usage. - handlers []gdb.ModelHandler // handlers for customized model modification. -} - -// PostColumns defines and stores column names for the table post. -type PostColumns struct { - Id string // - PostTitle string // 文章/视频标题 - PostContent string // 文章/视频内容 - VoteStatus string // 是否发起投票:1发起,0不发起 - CreateTime string // -} - -// postColumns holds the columns for the table post. -var postColumns = PostColumns{ - Id: "id", - PostTitle: "post_title", - PostContent: "post_content", - VoteStatus: "vote_status", - CreateTime: "create_time", -} - -// NewPostDao creates and returns a new DAO object for table data access. -func NewPostDao(handlers ...gdb.ModelHandler) *PostDao { - return &PostDao{ - group: "default", - table: "post", - columns: postColumns, - handlers: handlers, - } -} - -// DB retrieves and returns the underlying raw database management object of the current DAO. -func (dao *PostDao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of the current DAO. -func (dao *PostDao) Table() string { - return dao.table -} - -// Columns returns all column names of the current DAO. -func (dao *PostDao) Columns() PostColumns { - return dao.columns -} - -// Group returns the database configuration group name of the current DAO. -func (dao *PostDao) 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 *PostDao) Ctx(ctx context.Context) *gdb.Model { - model := dao.DB().Model(dao.table) - for _, handler := range dao.handlers { - model = handler(model) - } - return model.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 *PostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/internal/dao/internal/remain_vote_number.go b/internal/dao/internal/remain_vote_number.go deleted file mode 100644 index 72f1d37..0000000 --- a/internal/dao/internal/remain_vote_number.go +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// 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" -) - -// RemainVoteNumberDao is the data access object for the table remain_vote_number. -type RemainVoteNumberDao 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 RemainVoteNumberColumns // columns contains all the column names of Table for convenient usage. - handlers []gdb.ModelHandler // handlers for customized model modification. -} - -// RemainVoteNumberColumns defines and stores column names for the table remain_vote_number. -type RemainVoteNumberColumns struct { - Id string // - UserId string // - RemainTimes string // - LastDate string // -} - -// remainVoteNumberColumns holds the columns for the table remain_vote_number. -var remainVoteNumberColumns = RemainVoteNumberColumns{ - Id: "id", - UserId: "user_id", - RemainTimes: "remain_times", - LastDate: "last_date", -} - -// NewRemainVoteNumberDao creates and returns a new DAO object for table data access. -func NewRemainVoteNumberDao(handlers ...gdb.ModelHandler) *RemainVoteNumberDao { - return &RemainVoteNumberDao{ - group: "default", - table: "remain_vote_number", - columns: remainVoteNumberColumns, - handlers: handlers, - } -} - -// DB retrieves and returns the underlying raw database management object of the current DAO. -func (dao *RemainVoteNumberDao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of the current DAO. -func (dao *RemainVoteNumberDao) Table() string { - return dao.table -} - -// Columns returns all column names of the current DAO. -func (dao *RemainVoteNumberDao) Columns() RemainVoteNumberColumns { - return dao.columns -} - -// Group returns the database configuration group name of the current DAO. -func (dao *RemainVoteNumberDao) 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 *RemainVoteNumberDao) Ctx(ctx context.Context) *gdb.Model { - model := dao.DB().Model(dao.table) - for _, handler := range dao.handlers { - model = handler(model) - } - return model.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 *RemainVoteNumberDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/internal/dao/post.go b/internal/dao/post.go deleted file mode 100644 index 54784dd..0000000 --- a/internal/dao/post.go +++ /dev/null @@ -1,22 +0,0 @@ -// ================================================================================= -// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. -// ================================================================================= - -package dao - -import ( - "practice_ArticleVote_Go/internal/dao/internal" -) - -// postDao is the data access object for the table post. -// You can define custom methods on it to extend its functionality as needed. -type postDao struct { - *internal.PostDao -} - -var ( - // Post is a globally accessible object for table post operations. - Post = postDao{internal.NewPostDao()} -) - -// Add your custom methods and functionality below. diff --git a/internal/dao/remain_vote_number.go b/internal/dao/remain_vote_number.go deleted file mode 100644 index ee82e9d..0000000 --- a/internal/dao/remain_vote_number.go +++ /dev/null @@ -1,22 +0,0 @@ -// ================================================================================= -// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. -// ================================================================================= - -package dao - -import ( - "practice_ArticleVote_Go/internal/dao/internal" -) - -// remainVoteNumberDao is the data access object for the table remain_vote_number. -// You can define custom methods on it to extend its functionality as needed. -type remainVoteNumberDao struct { - *internal.RemainVoteNumberDao -} - -var ( - // RemainVoteNumber is a globally accessible object for table remain_vote_number operations. - RemainVoteNumber = remainVoteNumberDao{internal.NewRemainVoteNumberDao()} -) - -// Add your custom methods and functionality below. diff --git a/internal/model/do/post.go b/internal/model/do/post.go deleted file mode 100644 index 93e74bc..0000000 --- a/internal/model/do/post.go +++ /dev/null @@ -1,20 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package do - -import ( - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" -) - -// Post is the golang structure of table post for DAO operations like Where/Data. -type Post struct { - g.Meta `orm:"table:post, do:true"` - Id interface{} // - PostTitle interface{} // 文章/视频标题 - PostContent interface{} // 文章/视频内容 - VoteStatus interface{} // 是否发起投票:1发起,0不发起 - CreateTime *gtime.Time // -} diff --git a/internal/model/do/remain_vote_number.go b/internal/model/do/remain_vote_number.go deleted file mode 100644 index 954fddf..0000000 --- a/internal/model/do/remain_vote_number.go +++ /dev/null @@ -1,19 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package do - -import ( - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" -) - -// RemainVoteNumber is the golang structure of table remain_vote_number for DAO operations like Where/Data. -type RemainVoteNumber struct { - g.Meta `orm:"table:remain_vote_number, do:true"` - Id interface{} // - UserId interface{} // - RemainTimes interface{} // - LastDate *gtime.Time // -} diff --git a/internal/model/entity/post.go b/internal/model/entity/post.go deleted file mode 100644 index 5b00938..0000000 --- a/internal/model/entity/post.go +++ /dev/null @@ -1,18 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package entity - -import ( - "github.com/gogf/gf/v2/os/gtime" -) - -// Post is the golang structure for table post. -type Post struct { - Id int64 `json:"id" orm:"id" description:""` // - PostTitle string `json:"postTitle" orm:"post_title" description:"文章/视频标题"` // 文章/视频标题 - PostContent string `json:"postContent" orm:"post_content" description:"文章/视频内容"` // 文章/视频内容 - VoteStatus int `json:"voteStatus" orm:"vote_status" description:"是否发起投票:1发起,0不发起"` // 是否发起投票:1发起,0不发起 - CreateTime *gtime.Time `json:"createTime" orm:"create_time" description:""` // -} diff --git a/internal/model/entity/remain_vote_number.go b/internal/model/entity/remain_vote_number.go deleted file mode 100644 index 41823b8..0000000 --- a/internal/model/entity/remain_vote_number.go +++ /dev/null @@ -1,17 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package entity - -import ( - "github.com/gogf/gf/v2/os/gtime" -) - -// RemainVoteNumber is the golang structure for table remain_vote_number. -type RemainVoteNumber struct { - Id int64 `json:"id" orm:"id" description:""` // - UserId int64 `json:"userId" orm:"user_id" description:""` // - RemainTimes int `json:"remainTimes" orm:"remain_times" description:""` // - LastDate *gtime.Time `json:"lastDate" orm:"last_date" description:""` // -}