26 changed files with 667 additions and 3 deletions
-
15api/channel/channel.go
-
19api/channel/v1/channel.go
-
3go.mod
-
4go.sum
-
5internal/cmd/cmd.go
-
5internal/controller/channel/channel.go
-
15internal/controller/channel/channel_new.go
-
16internal/controller/channel/channel_v1_get_channel.go
-
27internal/dao/go_channel_subscriptions.go
-
27internal/dao/go_channels.go
-
27internal/dao/go_shows.go
-
27internal/dao/go_users.go
-
77internal/dao/internal/go_channel_subscriptions.go
-
81internal/dao/internal/go_channels.go
-
95internal/dao/internal/go_shows.go
-
79internal/dao/internal/go_users.go
-
17internal/model/do/go_channel_subscriptions.go
-
19internal/model/do/go_channels.go
-
27internal/model/do/go_shows.go
-
18internal/model/do/go_users.go
-
12internal/model/entity/go_channel_subscriptions.go
-
14internal/model/entity/go_channels.go
-
26internal/model/entity/go_shows.go
-
13internal/model/entity/go_users.go
-
BINmain.exe~
-
2main.go
@ -0,0 +1,15 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package channel |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"practice_Go/api/channel/v1" |
||||
|
) |
||||
|
|
||||
|
type IChannelV1 interface { |
||||
|
GetChannel(ctx context.Context, req *v1.GetChannelReq) (res *v1.GetChannelRes, err error) |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package v1 |
||||
|
|
||||
|
import ( |
||||
|
"practice_Go/internal/model/entity" |
||||
|
|
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
) |
||||
|
|
||||
|
type GetChannelReq struct { |
||||
|
g.Meta `path:"/channel" method:"get" tags:"Channel" summary:"获取单个频道"` |
||||
|
Id int `v:"required|min:1#频道ID不能为空|频道ID不能小于1" dc:"频道ID"` |
||||
|
userId int `v:"required|min:90000000|max:99999999#用户ID不能为空|用户ID不能小于90000000|用户ID不能大于99999999" dc:"用户ID"` |
||||
|
} |
||||
|
|
||||
|
type GetChannelRes struct { |
||||
|
*entity.GoChannels `json:"channel" dc:"单个频道"` |
||||
|
List []*entity.GoShows `json:"shows" dc:"频道下的所有节目和对应创作人"` |
||||
|
// `json:"status" dc:"频道是否订阅"`
|
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
// =================================================================================
|
||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package channel |
@ -0,0 +1,15 @@ |
|||||
|
// =================================================================================
|
||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package channel |
||||
|
|
||||
|
import ( |
||||
|
"practice_Go/api/channel" |
||||
|
) |
||||
|
|
||||
|
type ControllerV1 struct{} |
||||
|
|
||||
|
func NewV1() channel.IChannelV1 { |
||||
|
return &ControllerV1{} |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package channel |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"practice_Go/api/channel/v1" |
||||
|
"practice_Go/internal/dao" |
||||
|
"practice_Go/internal/model/entity" |
||||
|
) |
||||
|
|
||||
|
func (c *ControllerV1) GetChannel(ctx context.Context, req *v1.GetChannelReq) (res *v1.GetChannelRes, err error) { |
||||
|
err = dao.GoChannels.Ctx(ctx).WherePri(req.Id).Scan(&res.GoChannels) |
||||
|
err = dao.GoShows.Ctx(ctx).With(entity.GoUsers{}).Where("channel_id =?", req.Id).Scan(&res.List) |
||||
|
|
||||
|
return |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
// =================================================================================
|
||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package dao |
||||
|
|
||||
|
import ( |
||||
|
"practice_Go/internal/dao/internal" |
||||
|
) |
||||
|
|
||||
|
// internalGoChannelSubscriptionsDao is internal type for wrapping internal DAO implements.
|
||||
|
type internalGoChannelSubscriptionsDao = *internal.GoChannelSubscriptionsDao |
||||
|
|
||||
|
// goChannelSubscriptionsDao is the data access object for table go_channel_subscriptions.
|
||||
|
// You can define custom methods on it to extend its functionality as you wish.
|
||||
|
type goChannelSubscriptionsDao struct { |
||||
|
internalGoChannelSubscriptionsDao |
||||
|
} |
||||
|
|
||||
|
var ( |
||||
|
// GoChannelSubscriptions is globally public accessible object for table go_channel_subscriptions operations.
|
||||
|
GoChannelSubscriptions = goChannelSubscriptionsDao{ |
||||
|
internal.NewGoChannelSubscriptionsDao(), |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
// Fill with you ideas below.
|
@ -0,0 +1,27 @@ |
|||||
|
// =================================================================================
|
||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package dao |
||||
|
|
||||
|
import ( |
||||
|
"practice_Go/internal/dao/internal" |
||||
|
) |
||||
|
|
||||
|
// internalGoChannelsDao is internal type for wrapping internal DAO implements.
|
||||
|
type internalGoChannelsDao = *internal.GoChannelsDao |
||||
|
|
||||
|
// goChannelsDao is the data access object for table go_channels.
|
||||
|
// You can define custom methods on it to extend its functionality as you wish.
|
||||
|
type goChannelsDao struct { |
||||
|
internalGoChannelsDao |
||||
|
} |
||||
|
|
||||
|
var ( |
||||
|
// GoChannels is globally public accessible object for table go_channels operations.
|
||||
|
GoChannels = goChannelsDao{ |
||||
|
internal.NewGoChannelsDao(), |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
// Fill with you ideas below.
|
@ -0,0 +1,27 @@ |
|||||
|
// =================================================================================
|
||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package dao |
||||
|
|
||||
|
import ( |
||||
|
"practice_Go/internal/dao/internal" |
||||
|
) |
||||
|
|
||||
|
// internalGoShowsDao is internal type for wrapping internal DAO implements.
|
||||
|
type internalGoShowsDao = *internal.GoShowsDao |
||||
|
|
||||
|
// goShowsDao is the data access object for table go_shows.
|
||||
|
// You can define custom methods on it to extend its functionality as you wish.
|
||||
|
type goShowsDao struct { |
||||
|
internalGoShowsDao |
||||
|
} |
||||
|
|
||||
|
var ( |
||||
|
// GoShows is globally public accessible object for table go_shows operations.
|
||||
|
GoShows = goShowsDao{ |
||||
|
internal.NewGoShowsDao(), |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
// Fill with you ideas below.
|
@ -0,0 +1,27 @@ |
|||||
|
// =================================================================================
|
||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package dao |
||||
|
|
||||
|
import ( |
||||
|
"practice_Go/internal/dao/internal" |
||||
|
) |
||||
|
|
||||
|
// internalGoUsersDao is internal type for wrapping internal DAO implements.
|
||||
|
type internalGoUsersDao = *internal.GoUsersDao |
||||
|
|
||||
|
// goUsersDao is the data access object for table go_users.
|
||||
|
// You can define custom methods on it to extend its functionality as you wish.
|
||||
|
type goUsersDao struct { |
||||
|
internalGoUsersDao |
||||
|
} |
||||
|
|
||||
|
var ( |
||||
|
// GoUsers is globally public accessible object for table go_users operations.
|
||||
|
GoUsers = goUsersDao{ |
||||
|
internal.NewGoUsersDao(), |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
// Fill with you ideas below.
|
@ -0,0 +1,77 @@ |
|||||
|
// ==========================================================================
|
||||
|
// 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" |
||||
|
) |
||||
|
|
||||
|
// GoChannelSubscriptionsDao is the data access object for table go_channel_subscriptions.
|
||||
|
type GoChannelSubscriptionsDao struct { |
||||
|
table string // table is the underlying table name of the DAO.
|
||||
|
group string // group is the database configuration group name of current DAO.
|
||||
|
columns GoChannelSubscriptionsColumns // columns contains all the column names of Table for convenient usage.
|
||||
|
} |
||||
|
|
||||
|
// GoChannelSubscriptionsColumns defines and stores column names for table go_channel_subscriptions.
|
||||
|
type GoChannelSubscriptionsColumns struct { |
||||
|
Id string // 频道订阅关系唯一ID,自增
|
||||
|
UserId string // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
|
||||
|
ChannelId string // 关联的频道ID,指向go_channels表的id,不能为空
|
||||
|
} |
||||
|
|
||||
|
// goChannelSubscriptionsColumns holds the columns for table go_channel_subscriptions.
|
||||
|
var goChannelSubscriptionsColumns = GoChannelSubscriptionsColumns{ |
||||
|
Id: "id", |
||||
|
UserId: "user_id", |
||||
|
ChannelId: "channel_id", |
||||
|
} |
||||
|
|
||||
|
// NewGoChannelSubscriptionsDao creates and returns a new DAO object for table data access.
|
||||
|
func NewGoChannelSubscriptionsDao() *GoChannelSubscriptionsDao { |
||||
|
return &GoChannelSubscriptionsDao{ |
||||
|
group: "default", |
||||
|
table: "go_channel_subscriptions", |
||||
|
columns: goChannelSubscriptionsColumns, |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
|
func (dao *GoChannelSubscriptionsDao) DB() gdb.DB { |
||||
|
return g.DB(dao.group) |
||||
|
} |
||||
|
|
||||
|
// Table returns the table name of current dao.
|
||||
|
func (dao *GoChannelSubscriptionsDao) Table() string { |
||||
|
return dao.table |
||||
|
} |
||||
|
|
||||
|
// Columns returns all column names of current dao.
|
||||
|
func (dao *GoChannelSubscriptionsDao) Columns() GoChannelSubscriptionsColumns { |
||||
|
return dao.columns |
||||
|
} |
||||
|
|
||||
|
// Group returns the configuration group name of database of current dao.
|
||||
|
func (dao *GoChannelSubscriptionsDao) Group() string { |
||||
|
return dao.group |
||||
|
} |
||||
|
|
||||
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
|
func (dao *GoChannelSubscriptionsDao) Ctx(ctx context.Context) *gdb.Model { |
||||
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx) |
||||
|
} |
||||
|
|
||||
|
// Transaction wraps the transaction logic using function f.
|
||||
|
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
|
// It commits the transaction and returns nil if function f returns nil.
|
||||
|
//
|
||||
|
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
|
// as it is automatically handled by this function.
|
||||
|
func (dao *GoChannelSubscriptionsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { |
||||
|
return dao.Ctx(ctx).Transaction(ctx, f) |
||||
|
} |
@ -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" |
||||
|
) |
||||
|
|
||||
|
// GoChannelsDao is the data access object for table go_channels.
|
||||
|
type GoChannelsDao struct { |
||||
|
table string // table is the underlying table name of the DAO.
|
||||
|
group string // group is the database configuration group name of current DAO.
|
||||
|
columns GoChannelsColumns // columns contains all the column names of Table for convenient usage.
|
||||
|
} |
||||
|
|
||||
|
// GoChannelsColumns defines and stores column names for table go_channels.
|
||||
|
type GoChannelsColumns struct { |
||||
|
Id string // 频道唯一ID,自增
|
||||
|
Image string // 频道图片路径或相关标识,可为空
|
||||
|
Name string // 频道名称,最大长度255字符,不能为空
|
||||
|
SubscriptionCount string // 频道订阅数量,初始值为0,可累加
|
||||
|
BackgroundImage string // 频道背景图路径或相关标识,可为空
|
||||
|
} |
||||
|
|
||||
|
// goChannelsColumns holds the columns for table go_channels.
|
||||
|
var goChannelsColumns = GoChannelsColumns{ |
||||
|
Id: "id", |
||||
|
Image: "image", |
||||
|
Name: "name", |
||||
|
SubscriptionCount: "subscription_count", |
||||
|
BackgroundImage: "background_image", |
||||
|
} |
||||
|
|
||||
|
// NewGoChannelsDao creates and returns a new DAO object for table data access.
|
||||
|
func NewGoChannelsDao() *GoChannelsDao { |
||||
|
return &GoChannelsDao{ |
||||
|
group: "default", |
||||
|
table: "go_channels", |
||||
|
columns: goChannelsColumns, |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
|
func (dao *GoChannelsDao) DB() gdb.DB { |
||||
|
return g.DB(dao.group) |
||||
|
} |
||||
|
|
||||
|
// Table returns the table name of current dao.
|
||||
|
func (dao *GoChannelsDao) Table() string { |
||||
|
return dao.table |
||||
|
} |
||||
|
|
||||
|
// Columns returns all column names of current dao.
|
||||
|
func (dao *GoChannelsDao) Columns() GoChannelsColumns { |
||||
|
return dao.columns |
||||
|
} |
||||
|
|
||||
|
// Group returns the configuration group name of database of current dao.
|
||||
|
func (dao *GoChannelsDao) Group() string { |
||||
|
return dao.group |
||||
|
} |
||||
|
|
||||
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
|
func (dao *GoChannelsDao) Ctx(ctx context.Context) *gdb.Model { |
||||
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx) |
||||
|
} |
||||
|
|
||||
|
// Transaction wraps the transaction logic using function f.
|
||||
|
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
|
// It commits the transaction and returns nil if function f returns nil.
|
||||
|
//
|
||||
|
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
|
// as it is automatically handled by this function.
|
||||
|
func (dao *GoChannelsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { |
||||
|
return dao.Ctx(ctx).Transaction(ctx, f) |
||||
|
} |
@ -0,0 +1,95 @@ |
|||||
|
// ==========================================================================
|
||||
|
// 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" |
||||
|
) |
||||
|
|
||||
|
// GoShowsDao is the data access object for table go_shows.
|
||||
|
type GoShowsDao struct { |
||||
|
table string // table is the underlying table name of the DAO.
|
||||
|
group string // group is the database configuration group name of current DAO.
|
||||
|
columns GoShowsColumns // columns contains all the column names of Table for convenient usage.
|
||||
|
} |
||||
|
|
||||
|
// GoShowsColumns defines and stores column names for table go_shows.
|
||||
|
type GoShowsColumns struct { |
||||
|
Id string // 展示内容唯一ID,自增
|
||||
|
Cover string // 展示内容封面路径或相关标识,可为空
|
||||
|
Name string // 展示内容名称,最大长度255字符,不能为空
|
||||
|
UserId string // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
|
||||
|
ReleaseTime string // 展示内容发布时间,可为空
|
||||
|
VideoDuration string // 展示内容视频时长,格式根据实际情况定,可为空
|
||||
|
ViewCount string // 展示内容观看数量,初始值为0,可累加
|
||||
|
Comments string // 展示内容评论数量,初始值为0,可累加
|
||||
|
Likes string // 展示内容点赞数量,初始值为0,可累加
|
||||
|
FlagType string // 展示内容标识类型,按业务规则确定,可为空
|
||||
|
ClubId string // 关联的俱乐部ID,指向go_clubs表的id,可为空
|
||||
|
ChannelId string // 关联的频道ID,指向go_channels表的id,可为空
|
||||
|
} |
||||
|
|
||||
|
// goShowsColumns holds the columns for table go_shows.
|
||||
|
var goShowsColumns = GoShowsColumns{ |
||||
|
Id: "id", |
||||
|
Cover: "cover", |
||||
|
Name: "name", |
||||
|
UserId: "user_id", |
||||
|
ReleaseTime: "release_time", |
||||
|
VideoDuration: "video_duration", |
||||
|
ViewCount: "view_count", |
||||
|
Comments: "comments", |
||||
|
Likes: "likes", |
||||
|
FlagType: "flag_type", |
||||
|
ClubId: "club_id", |
||||
|
ChannelId: "channel_id", |
||||
|
} |
||||
|
|
||||
|
// NewGoShowsDao creates and returns a new DAO object for table data access.
|
||||
|
func NewGoShowsDao() *GoShowsDao { |
||||
|
return &GoShowsDao{ |
||||
|
group: "default", |
||||
|
table: "go_shows", |
||||
|
columns: goShowsColumns, |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
|
func (dao *GoShowsDao) DB() gdb.DB { |
||||
|
return g.DB(dao.group) |
||||
|
} |
||||
|
|
||||
|
// Table returns the table name of current dao.
|
||||
|
func (dao *GoShowsDao) Table() string { |
||||
|
return dao.table |
||||
|
} |
||||
|
|
||||
|
// Columns returns all column names of current dao.
|
||||
|
func (dao *GoShowsDao) Columns() GoShowsColumns { |
||||
|
return dao.columns |
||||
|
} |
||||
|
|
||||
|
// Group returns the configuration group name of database of current dao.
|
||||
|
func (dao *GoShowsDao) Group() string { |
||||
|
return dao.group |
||||
|
} |
||||
|
|
||||
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
|
func (dao *GoShowsDao) Ctx(ctx context.Context) *gdb.Model { |
||||
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx) |
||||
|
} |
||||
|
|
||||
|
// Transaction wraps the transaction logic using function f.
|
||||
|
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
|
// It commits the transaction and returns nil if function f returns nil.
|
||||
|
//
|
||||
|
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
|
// as it is automatically handled by this function.
|
||||
|
func (dao *GoShowsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { |
||||
|
return dao.Ctx(ctx).Transaction(ctx, f) |
||||
|
} |
@ -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" |
||||
|
) |
||||
|
|
||||
|
// GoUsersDao is the data access object for table go_users.
|
||||
|
type GoUsersDao struct { |
||||
|
table string // table is the underlying table name of the DAO.
|
||||
|
group string // group is the database configuration group name of current DAO.
|
||||
|
columns GoUsersColumns // columns contains all the column names of Table for convenient usage.
|
||||
|
} |
||||
|
|
||||
|
// GoUsersColumns defines and stores column names for table go_users.
|
||||
|
type GoUsersColumns struct { |
||||
|
Id string // 用户唯一ID,自增,长度为8位整数
|
||||
|
Username string // 用户名,最大长度255字符,不能为空
|
||||
|
Avatar string // 用户头像路径或相关标识,可为空
|
||||
|
Password string // 用户登录密码,最大长度255字符,不能为空
|
||||
|
} |
||||
|
|
||||
|
// goUsersColumns holds the columns for table go_users.
|
||||
|
var goUsersColumns = GoUsersColumns{ |
||||
|
Id: "id", |
||||
|
Username: "username", |
||||
|
Avatar: "avatar", |
||||
|
Password: "password", |
||||
|
} |
||||
|
|
||||
|
// NewGoUsersDao creates and returns a new DAO object for table data access.
|
||||
|
func NewGoUsersDao() *GoUsersDao { |
||||
|
return &GoUsersDao{ |
||||
|
group: "default", |
||||
|
table: "go_users", |
||||
|
columns: goUsersColumns, |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
|
func (dao *GoUsersDao) DB() gdb.DB { |
||||
|
return g.DB(dao.group) |
||||
|
} |
||||
|
|
||||
|
// Table returns the table name of current dao.
|
||||
|
func (dao *GoUsersDao) Table() string { |
||||
|
return dao.table |
||||
|
} |
||||
|
|
||||
|
// Columns returns all column names of current dao.
|
||||
|
func (dao *GoUsersDao) Columns() GoUsersColumns { |
||||
|
return dao.columns |
||||
|
} |
||||
|
|
||||
|
// Group returns the configuration group name of database of current dao.
|
||||
|
func (dao *GoUsersDao) Group() string { |
||||
|
return dao.group |
||||
|
} |
||||
|
|
||||
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
|
func (dao *GoUsersDao) Ctx(ctx context.Context) *gdb.Model { |
||||
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx) |
||||
|
} |
||||
|
|
||||
|
// Transaction wraps the transaction logic using function f.
|
||||
|
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
|
// It commits the transaction and returns nil if function f returns nil.
|
||||
|
//
|
||||
|
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
|
// as it is automatically handled by this function.
|
||||
|
func (dao *GoUsersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { |
||||
|
return dao.Ctx(ctx).Transaction(ctx, f) |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package do |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
) |
||||
|
|
||||
|
// GoChannelSubscriptions is the golang structure of table go_channel_subscriptions for DAO operations like Where/Data.
|
||||
|
type GoChannelSubscriptions struct { |
||||
|
g.Meta `orm:"table:go_channel_subscriptions, do:true"` |
||||
|
Id interface{} // 频道订阅关系唯一ID,自增
|
||||
|
UserId interface{} // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
|
||||
|
ChannelId interface{} // 关联的频道ID,指向go_channels表的id,不能为空
|
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package do |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
) |
||||
|
|
||||
|
// GoChannels is the golang structure of table go_channels for DAO operations like Where/Data.
|
||||
|
type GoChannels struct { |
||||
|
g.Meta `orm:"table:go_channels, do:true"` |
||||
|
Id interface{} // 频道唯一ID,自增
|
||||
|
Image interface{} // 频道图片路径或相关标识,可为空
|
||||
|
Name interface{} // 频道名称,最大长度255字符,不能为空
|
||||
|
SubscriptionCount interface{} // 频道订阅数量,初始值为0,可累加
|
||||
|
BackgroundImage interface{} // 频道背景图路径或相关标识,可为空
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
// =================================================================================
|
||||
|
// 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" |
||||
|
) |
||||
|
|
||||
|
// GoShows is the golang structure of table go_shows for DAO operations like Where/Data.
|
||||
|
type GoShows struct { |
||||
|
g.Meta `orm:"table:go_shows, do:true"` |
||||
|
Id interface{} // 展示内容唯一ID,自增
|
||||
|
Cover interface{} // 展示内容封面路径或相关标识,可为空
|
||||
|
Name interface{} // 展示内容名称,最大长度255字符,不能为空
|
||||
|
UserId interface{} // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
|
||||
|
ReleaseTime *gtime.Time // 展示内容发布时间,可为空
|
||||
|
VideoDuration *gtime.Time // 展示内容视频时长,格式根据实际情况定,可为空
|
||||
|
ViewCount interface{} // 展示内容观看数量,初始值为0,可累加
|
||||
|
Comments interface{} // 展示内容评论数量,初始值为0,可累加
|
||||
|
Likes interface{} // 展示内容点赞数量,初始值为0,可累加
|
||||
|
FlagType interface{} // 展示内容标识类型,按业务规则确定,可为空
|
||||
|
ClubId interface{} // 关联的俱乐部ID,指向go_clubs表的id,可为空
|
||||
|
ChannelId interface{} // 关联的频道ID,指向go_channels表的id,可为空
|
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package do |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
) |
||||
|
|
||||
|
// GoUsers is the golang structure of table go_users for DAO operations like Where/Data.
|
||||
|
type GoUsers struct { |
||||
|
g.Meta `orm:"table:go_users, do:true"` |
||||
|
Id interface{} // 用户唯一ID,自增,长度为8位整数
|
||||
|
Username interface{} // 用户名,最大长度255字符,不能为空
|
||||
|
Avatar interface{} // 用户头像路径或相关标识,可为空
|
||||
|
Password interface{} // 用户登录密码,最大长度255字符,不能为空
|
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package entity |
||||
|
|
||||
|
// GoChannelSubscriptions is the golang structure for table go_channel_subscriptions.
|
||||
|
type GoChannelSubscriptions struct { |
||||
|
Id int `json:"id" orm:"id" description:"频道订阅关系唯一ID,自增"` // 频道订阅关系唯一ID,自增
|
||||
|
UserId int `json:"userId" orm:"user_id" description:"关联的用户ID,指向go_users表的id,长度为8位整数,不能为空"` // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
|
||||
|
ChannelId int `json:"channelId" orm:"channel_id" description:"关联的频道ID,指向go_channels表的id,不能为空"` // 关联的频道ID,指向go_channels表的id,不能为空
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package entity |
||||
|
|
||||
|
// GoChannels is the golang structure for table go_channels.
|
||||
|
type GoChannels struct { |
||||
|
Id int `json:"id" orm:"id" description:"频道唯一ID,自增"` // 频道唯一ID,自增
|
||||
|
Image string `json:"image" orm:"image" description:"频道图片路径或相关标识,可为空"` // 频道图片路径或相关标识,可为空
|
||||
|
Name string `json:"name" orm:"name" description:"频道名称,最大长度255字符,不能为空"` // 频道名称,最大长度255字符,不能为空
|
||||
|
SubscriptionCount int `json:"subscriptionCount" orm:"subscription_count" description:"频道订阅数量,初始值为0,可累加"` // 频道订阅数量,初始值为0,可累加
|
||||
|
BackgroundImage string `json:"backgroundImage" orm:"background_image" description:"频道背景图路径或相关标识,可为空"` // 频道背景图路径或相关标识,可为空
|
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package entity |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/os/gtime" |
||||
|
) |
||||
|
|
||||
|
// GoShows is the golang structure for table go_shows.
|
||||
|
type GoShows struct { |
||||
|
Id int `json:"id" orm:"id" description:"展示内容唯一ID,自增"` // 展示内容唯一ID,自增
|
||||
|
Cover string `json:"cover" orm:"cover" description:"展示内容封面路径或相关标识,可为空"` // 展示内容封面路径或相关标识,可为空
|
||||
|
Name string `json:"name" orm:"name" description:"展示内容名称,最大长度255字符,不能为空"` // 展示内容名称,最大长度255字符,不能为空
|
||||
|
UserId int `json:"userId" orm:"user_id" description:"关联的用户ID,指向go_users表的id,长度为8位整数,不能为空"` // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
|
||||
|
User *GoUsers `json:"user" orm:"with:id=user_id" description:"关联的用户信息"` // 关联的用户信息
|
||||
|
ReleaseTime *gtime.Time `json:"releaseTime" orm:"release_time" description:"展示内容发布时间,可为空"` // 展示内容发布时间,可为空
|
||||
|
VideoDuration *gtime.Time `json:"videoDuration" orm:"video_duration" description:"展示内容视频时长,格式根据实际情况定,可为空"` // 展示内容视频时长,格式根据实际情况定,可为空
|
||||
|
ViewCount int `json:"viewCount" orm:"view_count" description:"展示内容观看数量,初始值为0,可累加"` // 展示内容观看数量,初始值为0,可累加
|
||||
|
Comments int `json:"comments" orm:"comments" description:"展示内容评论数量,初始值为0,可累加"` // 展示内容评论数量,初始值为0,可累加
|
||||
|
Likes int `json:"likes" orm:"likes" description:"展示内容点赞数量,初始值为0,可累加"` // 展示内容点赞数量,初始值为0,可累加
|
||||
|
FlagType int `json:"flagType" orm:"flag_type" description:"展示内容标识类型,按业务规则确定,可为空"` // 展示内容标识类型,按业务规则确定,可为空
|
||||
|
ClubId int `json:"clubId" orm:"club_id" description:"关联的俱乐部ID,指向go_clubs表的id,可为空"` // 关联的俱乐部ID,指向go_clubs表的id,可为空
|
||||
|
ChannelId int `json:"channelId" orm:"channel_id" description:"关联的频道ID,指向go_channels表的id,可为空"` // 关联的频道ID,指向go_channels表的id,可为空
|
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package entity |
||||
|
|
||||
|
// GoUsers is the golang structure for table go_users.
|
||||
|
type GoUsers struct { |
||||
|
Id int `json:"id" orm:"id" description:"用户唯一ID,自增,长度为8位整数"` // 用户唯一ID,自增,长度为8位整数
|
||||
|
Username string `json:"username" orm:"username" description:"用户名,最大长度255字符,不能为空"` // 用户名,最大长度255字符,不能为空
|
||||
|
Avatar string `json:"avatar" orm:"avatar" description:"用户头像路径或相关标识,可为空"` // 用户头像路径或相关标识,可为空
|
||||
|
Password string `json:"password" orm:"password" description:"用户登录密码,最大长度255字符,不能为空"` // 用户登录密码,最大长度255字符,不能为空
|
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue