创建任务表、用户任务表,生成 model、dao
This commit is contained in:
81
internal/dao/internal/tasks.go
Normal file
81
internal/dao/internal/tasks.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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TasksDao is the data access object for the table tasks.
|
||||||
|
type TasksDao 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 TasksColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
}
|
||||||
|
|
||||||
|
// TasksColumns defines and stores column names for the table tasks.
|
||||||
|
type TasksColumns struct {
|
||||||
|
Id string // 任务唯一标识符
|
||||||
|
QqNetbarTaskId string // QQ网吧任务ID
|
||||||
|
CreatedAt string // 创建时间
|
||||||
|
UpdatedAt string // 更新时间
|
||||||
|
DeletedAt string // 软删除时间戳
|
||||||
|
}
|
||||||
|
|
||||||
|
// tasksColumns holds the columns for the table tasks.
|
||||||
|
var tasksColumns = TasksColumns{
|
||||||
|
Id: "id",
|
||||||
|
QqNetbarTaskId: "qq_netbar_task_id",
|
||||||
|
CreatedAt: "created_at",
|
||||||
|
UpdatedAt: "updated_at",
|
||||||
|
DeletedAt: "deleted_at",
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewTasksDao creates and returns a new DAO object for table data access.
|
||||||
|
func NewTasksDao() *TasksDao {
|
||||||
|
return &TasksDao{
|
||||||
|
group: "default",
|
||||||
|
table: "tasks",
|
||||||
|
columns: tasksColumns,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
|
func (dao *TasksDao) DB() gdb.DB {
|
||||||
|
return g.DB(dao.group)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Table returns the table name of the current DAO.
|
||||||
|
func (dao *TasksDao) Table() string {
|
||||||
|
return dao.table
|
||||||
|
}
|
||||||
|
|
||||||
|
// Columns returns all column names of the current DAO.
|
||||||
|
func (dao *TasksDao) Columns() TasksColumns {
|
||||||
|
return dao.columns
|
||||||
|
}
|
||||||
|
|
||||||
|
// Group returns the database configuration group name of the current DAO.
|
||||||
|
func (dao *TasksDao) 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 *TasksDao) 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 *TasksDao) 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/user_tasks.go
Normal file
89
internal/dao/internal/user_tasks.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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserTasksDao is the data access object for the table user_tasks.
|
||||||
|
type UserTasksDao 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 UserTasksColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserTasksColumns defines and stores column names for the table user_tasks.
|
||||||
|
type UserTasksColumns struct {
|
||||||
|
Id string // 用户任务唯一标识符
|
||||||
|
UserId string // 用户ID
|
||||||
|
TaskId string // 任务ID
|
||||||
|
Status string // 任务状态:1=已领取,2=进行中,3=已完成,4=已取消
|
||||||
|
SerialNumber string // 流水号,确保用户任务唯一性
|
||||||
|
CreatedAt string // 创建时间
|
||||||
|
UpdatedAt string // 更新时间
|
||||||
|
CompletedAt string // 任务完成时间
|
||||||
|
DeletedAt string // 软删除时间戳
|
||||||
|
}
|
||||||
|
|
||||||
|
// userTasksColumns holds the columns for the table user_tasks.
|
||||||
|
var userTasksColumns = UserTasksColumns{
|
||||||
|
Id: "id",
|
||||||
|
UserId: "user_id",
|
||||||
|
TaskId: "task_id",
|
||||||
|
Status: "status",
|
||||||
|
SerialNumber: "serial_number",
|
||||||
|
CreatedAt: "created_at",
|
||||||
|
UpdatedAt: "updated_at",
|
||||||
|
CompletedAt: "completed_at",
|
||||||
|
DeletedAt: "deleted_at",
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewUserTasksDao creates and returns a new DAO object for table data access.
|
||||||
|
func NewUserTasksDao() *UserTasksDao {
|
||||||
|
return &UserTasksDao{
|
||||||
|
group: "default",
|
||||||
|
table: "user_tasks",
|
||||||
|
columns: userTasksColumns,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
|
func (dao *UserTasksDao) DB() gdb.DB {
|
||||||
|
return g.DB(dao.group)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Table returns the table name of the current DAO.
|
||||||
|
func (dao *UserTasksDao) Table() string {
|
||||||
|
return dao.table
|
||||||
|
}
|
||||||
|
|
||||||
|
// Columns returns all column names of the current DAO.
|
||||||
|
func (dao *UserTasksDao) Columns() UserTasksColumns {
|
||||||
|
return dao.columns
|
||||||
|
}
|
||||||
|
|
||||||
|
// Group returns the database configuration group name of the current DAO.
|
||||||
|
func (dao *UserTasksDao) 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 *UserTasksDao) 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 *UserTasksDao) 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/tasks.go
Normal file
27
internal/dao/tasks.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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// internalTasksDao is an internal type for wrapping the internal DAO implementation.
|
||||||
|
type internalTasksDao = *internal.TasksDao
|
||||||
|
|
||||||
|
// tasksDao is the data access object for the table tasks.
|
||||||
|
// You can define custom methods on it to extend its functionality as needed.
|
||||||
|
type tasksDao struct {
|
||||||
|
internalTasksDao
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Tasks is a globally accessible object for table tasks operations.
|
||||||
|
Tasks = tasksDao{
|
||||||
|
internal.NewTasksDao(),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Add your custom methods and functionality below.
|
||||||
27
internal/dao/user_tasks.go
Normal file
27
internal/dao/user_tasks.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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// internalUserTasksDao is an internal type for wrapping the internal DAO implementation.
|
||||||
|
type internalUserTasksDao = *internal.UserTasksDao
|
||||||
|
|
||||||
|
// userTasksDao is the data access object for the table user_tasks.
|
||||||
|
// You can define custom methods on it to extend its functionality as needed.
|
||||||
|
type userTasksDao struct {
|
||||||
|
internalUserTasksDao
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// UserTasks is a globally accessible object for table user_tasks operations.
|
||||||
|
UserTasks = userTasksDao{
|
||||||
|
internal.NewUserTasksDao(),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Add your custom methods and functionality below.
|
||||||
20
internal/model/do/tasks.go
Normal file
20
internal/model/do/tasks.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// =================================================================================
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Tasks is the golang structure of table tasks for DAO operations like Where/Data.
|
||||||
|
type Tasks struct {
|
||||||
|
g.Meta `orm:"table:tasks, do:true"`
|
||||||
|
Id interface{} // 任务唯一标识符
|
||||||
|
QqNetbarTaskId interface{} // QQ网吧任务ID
|
||||||
|
CreatedAt *gtime.Time // 创建时间
|
||||||
|
UpdatedAt *gtime.Time // 更新时间
|
||||||
|
DeletedAt *gtime.Time // 软删除时间戳
|
||||||
|
}
|
||||||
24
internal/model/do/user_tasks.go
Normal file
24
internal/model/do/user_tasks.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// =================================================================================
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserTasks is the golang structure of table user_tasks for DAO operations like Where/Data.
|
||||||
|
type UserTasks struct {
|
||||||
|
g.Meta `orm:"table:user_tasks, do:true"`
|
||||||
|
Id interface{} // 用户任务唯一标识符
|
||||||
|
UserId interface{} // 用户ID
|
||||||
|
TaskId interface{} // 任务ID
|
||||||
|
Status interface{} // 任务状态:1=已领取,2=进行中,3=已完成,4=已取消
|
||||||
|
SerialNumber interface{} // 流水号,确保用户任务唯一性
|
||||||
|
CreatedAt *gtime.Time // 创建时间
|
||||||
|
UpdatedAt *gtime.Time // 更新时间
|
||||||
|
CompletedAt *gtime.Time // 任务完成时间
|
||||||
|
DeletedAt *gtime.Time // 软删除时间戳
|
||||||
|
}
|
||||||
18
internal/model/entity/tasks.go
Normal file
18
internal/model/entity/tasks.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// =================================================================================
|
||||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||||
|
// =================================================================================
|
||||||
|
|
||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Tasks is the golang structure for table tasks.
|
||||||
|
type Tasks struct {
|
||||||
|
Id int64 `json:"id" orm:"id" description:"任务唯一标识符"` // 任务唯一标识符
|
||||||
|
QqNetbarTaskId string `json:"qqNetbarTaskId" orm:"qq_netbar_task_id" description:"QQ网吧任务ID"` // QQ网吧任务ID
|
||||||
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||||
|
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||||
|
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
|
||||||
|
}
|
||||||
22
internal/model/entity/user_tasks.go
Normal file
22
internal/model/entity/user_tasks.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// =================================================================================
|
||||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||||
|
// =================================================================================
|
||||||
|
|
||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserTasks is the golang structure for table user_tasks.
|
||||||
|
type UserTasks struct {
|
||||||
|
Id int64 `json:"id" orm:"id" description:"用户任务唯一标识符"` // 用户任务唯一标识符
|
||||||
|
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
|
||||||
|
TaskId int64 `json:"taskId" orm:"task_id" description:"任务ID"` // 任务ID
|
||||||
|
Status int `json:"status" orm:"status" description:"任务状态:1=已领取,2=进行中,3=已完成,4=已取消"` // 任务状态:1=已领取,2=进行中,3=已完成,4=已取消
|
||||||
|
SerialNumber string `json:"serialNumber" orm:"serial_number" description:"流水号,确保用户任务唯一性"` // 流水号,确保用户任务唯一性
|
||||||
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||||
|
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||||
|
CompletedAt *gtime.Time `json:"completedAt" orm:"completed_at" description:"任务完成时间"` // 任务完成时间
|
||||||
|
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user