Compare commits

...

10 Commits

Author SHA1 Message Date
majun 2736d4d588 排序更新 7 months ago
majun 133b3b5935 直播完成 7 months ago
majun e26c366843 查询完成 7 months ago
majun 7db21eea0f 查询直播数据 7 months ago
majun bd279fb85f 初始化v2 7 months ago
majun 5705c1c9ac 初始化 7 months ago
majun b7d9d0227f 环境搭建 7 months ago
majun 93150398bc 清空 7 months ago
majun 750776dbce 搭建框架 7 months ago
majun e78e7fbf86 清空 7 months ago
  1. 0
      .gitattributes
  2. 0
      .gitignore
  3. 0
      Makefile
  4. 0
      README.MD
  5. 8
      api/live/live.go
  6. 21
      api/live/v1/live.go
  7. 16
      api/reservation/reservation.go
  8. 23
      api/reservation/v1/reservation.go
  9. 12
      demo/api/hello/v1/hello.go
  10. 13
      demo/internal/controller/hello/hello_v1_hello.go
  11. 13
      demo/main.go
  12. 5
      go.mod
  13. 4
      go.sum
  14. 2
      hack/config.yaml
  15. 0
      hack/hack-cli.mk
  16. 0
      hack/hack.mk
  17. 8
      internal/cmd/cmd.go
  18. 0
      internal/consts/consts.go
  19. 2
      internal/controller/live/live.go
  20. 9
      internal/controller/live/live_new.go
  21. 20
      internal/controller/live/live_v1_get_live.go
  22. 5
      internal/controller/reservation/reservation.go
  23. 15
      internal/controller/reservation/reservation_new.go
  24. 21
      internal/controller/reservation/reservation_v1_add_reservation.go
  25. 17
      internal/controller/reservation/reservation_v1_delete_reservation.go
  26. 0
      internal/dao/.gitkeep
  27. 27
      internal/dao/go_live_reservations.go
  28. 27
      internal/dao/go_lives.go
  29. 27
      internal/dao/go_users.go
  30. 77
      internal/dao/internal/go_live_reservations.go
  31. 83
      internal/dao/internal/go_lives.go
  32. 79
      internal/dao/internal/go_users.go
  33. 0
      internal/logic/.gitkeep
  34. 0
      internal/model/.gitkeep
  35. 0
      internal/model/do/.gitkeep
  36. 17
      internal/model/do/go_live_reservations.go
  37. 21
      internal/model/do/go_lives.go
  38. 18
      internal/model/do/go_users.go
  39. 0
      internal/model/entity/.gitkeep
  40. 12
      internal/model/entity/go_live_reservations.go
  41. 20
      internal/model/entity/go_lives.go
  42. 13
      internal/model/entity/go_users.go
  43. 0
      internal/packed/packed.go
  44. 0
      internal/service/.gitkeep
  45. 15
      main.go
  46. 0
      manifest/deploy/kustomize/base/deployment.yaml
  47. 0
      manifest/deploy/kustomize/base/kustomization.yaml
  48. 0
      manifest/deploy/kustomize/base/service.yaml
  49. 0
      manifest/deploy/kustomize/overlays/develop/configmap.yaml
  50. 0
      manifest/deploy/kustomize/overlays/develop/deployment.yaml
  51. 0
      manifest/deploy/kustomize/overlays/develop/kustomization.yaml
  52. 0
      manifest/docker/Dockerfile
  53. 0
      manifest/docker/docker.sh
  54. 0
      manifest/i18n/.gitkeep
  55. 0
      manifest/protobuf/.keep-if-necessary
  56. 0
      resource/public/html/.gitkeep
  57. 532
      resource/public/html/api.html
  58. 0
      resource/public/plugin/.gitkeep
  59. 0
      resource/public/resource/css/.gitkeep
  60. 0
      resource/public/resource/image/.gitkeep
  61. 0
      resource/public/resource/js/.gitkeep
  62. 0
      resource/template/.gitkeep
  63. 0
      utility/.gitkeep

0
demo/.gitattributes → .gitattributes

0
demo/.gitignore → .gitignore

0
demo/Makefile → Makefile

0
demo/README.MD → README.MD

8
demo/api/hello/hello.go → api/live/live.go

@ -2,14 +2,14 @@
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package hello
package live
import (
"context"
"demo/api/hello/v1"
"practice_Go/api/live/v1"
)
type IHelloV1 interface {
Hello(ctx context.Context, req *v1.HelloReq) (res *v1.HelloRes, err error)
type ILiveV1 interface {
GetLive(ctx context.Context, req *v1.GetLiveReq) (res *v1.GetLiveRes, err error)
}

21
api/live/v1/live.go

@ -0,0 +1,21 @@
package v1
import (
"practice_Go/internal/model/entity"
"github.com/gogf/gf/v2/frame/g"
)
type Live struct {
entity.GoLives
Reservation int `json:"reservation" dc:"预约状态"`
}
type GetLiveReq struct {
g.Meta `path:"/live" method:"get" tags:"Live" summary:"获取直播列表"`
UserId int `v:"required|min:90000000|max:99999999#用户ID不能为空|用户ID不能小于90000000|用户ID不能大于99999999" dc:"用户ID"`
}
type GetLiveRes struct {
List []*Live `json:"liveList" dc:"直播列表"`
}

16
api/reservation/reservation.go

@ -0,0 +1,16 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package reservation
import (
"context"
"practice_Go/api/reservation/v1"
)
type IReservationV1 interface {
AddReservation(ctx context.Context, req *v1.AddReservationReq) (res *v1.AddReservationRes, err error)
DeleteReservation(ctx context.Context, req *v1.DeleteReservationReq) (res *v1.DeleteReservationRes, err error)
}

23
api/reservation/v1/reservation.go

@ -0,0 +1,23 @@
package v1
import "github.com/gogf/gf/v2/frame/g"
type AddReservationReq struct {
g.Meta `path:"/reservation" method:"post" tags:"Reservation" 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 AddReservationRes struct {
Success bool `json:"success" dc:"预约是否成功"`
}
type DeleteReservationReq struct {
g.Meta `path:"/reservation" method:"delete" tags:"Reservation" 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 DeleteReservationRes struct {
Success bool `json:"success" dc:"取消预约是否成功"`
}

12
demo/api/hello/v1/hello.go

@ -1,12 +0,0 @@
package v1
import (
"github.com/gogf/gf/v2/frame/g"
)
type HelloReq struct {
g.Meta `path:"/hello" tags:"Hello" method:"get" summary:"You first hello api"`
}
type HelloRes struct {
g.Meta `mime:"text/html" example:"string"`
}

13
demo/internal/controller/hello/hello_v1_hello.go

@ -1,13 +0,0 @@
package hello
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"demo/api/hello/v1"
)
func (c *ControllerV1) Hello(ctx context.Context, req *v1.HelloReq) (res *v1.HelloRes, err error) {
g.RequestFromCtx(ctx).Response.Writeln("Hello World!")
return
}

13
demo/main.go

@ -1,13 +0,0 @@
package main
import (
_ "demo/internal/packed"
"github.com/gogf/gf/v2/os/gctx"
"demo/internal/cmd"
)
func main() {
cmd.Main.Run(gctx.GetInitCtx())
}

5
demo/go.mod → go.mod

@ -1,9 +1,11 @@
module demo
module practice_Go
go 1.18
require github.com/gogf/gf/v2 v2.8.1
require github.com/go-sql-driver/mysql v1.7.1 // indirect
require (
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/clbanning/mxj/v2 v2.7.0 // indirect
@ -12,6 +14,7 @@ require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.8.1
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grokify/html-strip-tags-go v0.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect

4
demo/go.sum → go.sum

@ -14,6 +14,10 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.8.1 h1:jbaPawkb8qmaYzrmBDbTa8Zkhzacq1RBOZw+qRJExI4=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.8.1/go.mod h1:s2aI1fV9AvKi4NtMpv3pV0EHtazkvfUNVQmzapr7UJQ=
github.com/gogf/gf/v2 v2.8.1 h1:1oVQg3G5OgCats4qWFTH3pHLe92nfUQeUDta05tUs1g=
github.com/gogf/gf/v2 v2.8.1/go.mod h1:6iYuZZ+A0ZcH8+4MDS/P0SvTPCvKzRvyAsY1kbkJYJc=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=

2
demo/hack/config.yaml → hack/config.yaml

@ -4,7 +4,7 @@
gfcli:
gen:
dao:
- link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
- link: "mysql:root:123456@tcp(127.0.0.1:3306)/demo"
descriptionTag: true
docker:

0
demo/hack/hack-cli.mk → hack/hack-cli.mk

0
demo/hack/hack.mk → hack/hack.mk

8
demo/internal/cmd/cmd.go → internal/cmd/cmd.go

@ -2,12 +2,12 @@ package cmd
import (
"context"
"practice_Go/internal/controller/live"
"practice_Go/internal/controller/reservation"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/os/gcmd"
"demo/internal/controller/hello"
)
var (
@ -20,9 +20,11 @@ var (
s.Group("/", func(group *ghttp.RouterGroup) {
group.Middleware(ghttp.MiddlewareHandlerResponse)
group.Bind(
hello.NewV1(),
live.NewV1(),
reservation.NewV1(),
)
})
s.SetServerRoot("resource/public")
s.Run()
return nil
},

0
demo/internal/consts/consts.go → internal/consts/consts.go

2
demo/internal/controller/hello/hello.go → internal/controller/live/live.go

@ -2,4 +2,4 @@
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package hello
package live

9
demo/internal/controller/hello/hello_new.go → internal/controller/live/live_new.go

@ -1,16 +1,15 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package hello
package live
import (
"demo/api/hello"
"practice_Go/api/live"
)
type ControllerV1 struct{}
func NewV1() hello.IHelloV1 {
func NewV1() live.ILiveV1 {
return &ControllerV1{}
}

20
internal/controller/live/live_v1_get_live.go

@ -0,0 +1,20 @@
package live
import (
"context"
"time"
"practice_Go/api/live/v1"
"practice_Go/internal/dao"
"practice_Go/internal/model/entity"
)
func (c *ControllerV1) GetLive(ctx context.Context, req *v1.GetLiveReq) (res *v1.GetLiveRes, err error) {
res = &v1.GetLiveRes{}
now := time.Now()
err = dao.GoLives.Ctx(ctx).With(entity.GoUsers{}).Where("start_time >=? or status = 1", now).Order("status desc, start_time asc").Scan(&res.List)
for i, live := range res.List {
res.List[i].Reservation, err = dao.GoLiveReservations.Ctx(ctx).Wheref("live_id =? and user_id =?", live.Id, req.UserId).Count()
}
return
}

5
internal/controller/reservation/reservation.go

@ -0,0 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package reservation

15
internal/controller/reservation/reservation_new.go

@ -0,0 +1,15 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package reservation
import (
"practice_Go/api/reservation"
)
type ControllerV1 struct{}
func NewV1() reservation.IReservationV1 {
return &ControllerV1{}
}

21
internal/controller/reservation/reservation_v1_add_reservation.go

@ -0,0 +1,21 @@
package reservation
import (
"context"
"practice_Go/api/reservation/v1"
"practice_Go/internal/dao"
"practice_Go/internal/model/do"
)
func (c *ControllerV1) AddReservation(ctx context.Context, req *v1.AddReservationReq) (res *v1.AddReservationRes, err error) {
res = &v1.AddReservationRes{}
_, err = dao.GoLiveReservations.Ctx(ctx).Data(do.GoLiveReservations{
LiveId: req.Id,
UserId: req.UserId,
}).Insert()
if err == nil {
res.Success = true
}
return
}

17
internal/controller/reservation/reservation_v1_delete_reservation.go

@ -0,0 +1,17 @@
package reservation
import (
"context"
"practice_Go/api/reservation/v1"
"practice_Go/internal/dao"
)
func (c *ControllerV1) DeleteReservation(ctx context.Context, req *v1.DeleteReservationReq) (res *v1.DeleteReservationRes, err error) {
res = &v1.DeleteReservationRes{}
_, err = dao.GoLiveReservations.Ctx(ctx).Wheref("live_id =? and user_id =?", req.Id, req.UserId).Delete()
if err == nil {
res.Success = true
}
return
}

0
demo/internal/dao/.gitkeep → internal/dao/.gitkeep

27
internal/dao/go_live_reservations.go

@ -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"
)
// internalGoLiveReservationsDao is internal type for wrapping internal DAO implements.
type internalGoLiveReservationsDao = *internal.GoLiveReservationsDao
// goLiveReservationsDao is the data access object for table go_live_reservations.
// You can define custom methods on it to extend its functionality as you wish.
type goLiveReservationsDao struct {
internalGoLiveReservationsDao
}
var (
// GoLiveReservations is globally public accessible object for table go_live_reservations operations.
GoLiveReservations = goLiveReservationsDao{
internal.NewGoLiveReservationsDao(),
}
)
// Fill with you ideas below.

27
internal/dao/go_lives.go

@ -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"
)
// internalGoLivesDao is internal type for wrapping internal DAO implements.
type internalGoLivesDao = *internal.GoLivesDao
// goLivesDao is the data access object for table go_lives.
// You can define custom methods on it to extend its functionality as you wish.
type goLivesDao struct {
internalGoLivesDao
}
var (
// GoLives is globally public accessible object for table go_lives operations.
GoLives = goLivesDao{
internal.NewGoLivesDao(),
}
)
// Fill with you ideas below.

27
internal/dao/go_users.go

@ -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.

77
internal/dao/internal/go_live_reservations.go

@ -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"
)
// GoLiveReservationsDao is the data access object for table go_live_reservations.
type GoLiveReservationsDao 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 GoLiveReservationsColumns // columns contains all the column names of Table for convenient usage.
}
// GoLiveReservationsColumns defines and stores column names for table go_live_reservations.
type GoLiveReservationsColumns struct {
Id string // 直播预约关系唯一ID,自增
UserId string // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
LiveId string // 关联的直播ID,指向go_lives表的id,不能为空
}
// goLiveReservationsColumns holds the columns for table go_live_reservations.
var goLiveReservationsColumns = GoLiveReservationsColumns{
Id: "id",
UserId: "user_id",
LiveId: "live_id",
}
// NewGoLiveReservationsDao creates and returns a new DAO object for table data access.
func NewGoLiveReservationsDao() *GoLiveReservationsDao {
return &GoLiveReservationsDao{
group: "default",
table: "go_live_reservations",
columns: goLiveReservationsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *GoLiveReservationsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *GoLiveReservationsDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *GoLiveReservationsDao) Columns() GoLiveReservationsColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *GoLiveReservationsDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *GoLiveReservationsDao) 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 *GoLiveReservationsDao) 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/go_lives.go

@ -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"
)
// GoLivesDao is the data access object for table go_lives.
type GoLivesDao 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 GoLivesColumns // columns contains all the column names of Table for convenient usage.
}
// GoLivesColumns defines and stores column names for table go_lives.
type GoLivesColumns struct {
Id string // 直播唯一ID,自增
Cover string // 直播封面路径或相关标识,可为空
UserId string // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
LiveName string // 直播名称,最大长度255字符,不能为空
StartTime string // 直播开始时间,不能为空
Status string // 直播状态,0:未开播 1:已开播,不能为空
}
// goLivesColumns holds the columns for table go_lives.
var goLivesColumns = GoLivesColumns{
Id: "id",
Cover: "cover",
UserId: "user_id",
LiveName: "live_name",
StartTime: "start_time",
Status: "status",
}
// NewGoLivesDao creates and returns a new DAO object for table data access.
func NewGoLivesDao() *GoLivesDao {
return &GoLivesDao{
group: "default",
table: "go_lives",
columns: goLivesColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *GoLivesDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *GoLivesDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *GoLivesDao) Columns() GoLivesColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *GoLivesDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *GoLivesDao) 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 *GoLivesDao) 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/go_users.go

@ -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
demo/internal/logic/.gitkeep → internal/logic/.gitkeep

0
demo/internal/model/.gitkeep → internal/model/.gitkeep

0
demo/internal/model/do/.gitkeep → internal/model/do/.gitkeep

17
internal/model/do/go_live_reservations.go

@ -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"
)
// GoLiveReservations is the golang structure of table go_live_reservations for DAO operations like Where/Data.
type GoLiveReservations struct {
g.Meta `orm:"table:go_live_reservations, do:true"`
Id interface{} // 直播预约关系唯一ID,自增
UserId interface{} // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
LiveId interface{} // 关联的直播ID,指向go_lives表的id,不能为空
}

21
internal/model/do/go_lives.go

@ -0,0 +1,21 @@
// =================================================================================
// 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"
)
// GoLives is the golang structure of table go_lives for DAO operations like Where/Data.
type GoLives struct {
g.Meta `orm:"table:go_lives, do:true"`
Id interface{} // 直播唯一ID,自增
Cover interface{} // 直播封面路径或相关标识,可为空
UserId interface{} // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
LiveName interface{} // 直播名称,最大长度255字符,不能为空
StartTime *gtime.Time // 直播开始时间,不能为空
Status interface{} // 直播状态,0:未开播 1:已开播,不能为空
}

18
internal/model/do/go_users.go

@ -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
demo/internal/model/entity/.gitkeep → internal/model/entity/.gitkeep

12
internal/model/entity/go_live_reservations.go

@ -0,0 +1,12 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
// GoLiveReservations is the golang structure for table go_live_reservations.
type GoLiveReservations 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位整数,不能为空
LiveId int `json:"liveId" orm:"live_id" description:"关联的直播ID,指向go_lives表的id,不能为空"` // 关联的直播ID,指向go_lives表的id,不能为空
}

20
internal/model/entity/go_lives.go

@ -0,0 +1,20 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// GoLives is the golang structure for table go_lives.
type GoLives struct {
Id int `json:"id" orm:"id" description:"直播唯一ID,自增"` // 直播唯一ID,自增
Cover string `json:"cover" orm:"cover" description:"直播封面路径或相关标识,可为空"` // 直播封面路径或相关标识,可为空
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:"关联的用户信息"` // 关联的用户信息
LiveName string `json:"liveName" orm:"live_name" description:"直播名称,最大长度255字符,不能为空"` // 直播名称,最大长度255字符,不能为空
StartTime *gtime.Time `json:"startTime" orm:"start_time" description:"直播开始时间,不能为空"` // 直播开始时间,不能为空
Status int `json:"status" orm:"status" description:"直播状态,0:未开播 1:已开播,不能为空"` // 直播状态,0:未开播 1:已开播,不能为空
}

13
internal/model/entity/go_users.go

@ -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字符,不能为空
}

0
demo/internal/packed/packed.go → internal/packed/packed.go

0
demo/internal/service/.gitkeep → internal/service/.gitkeep

15
main.go

@ -0,0 +1,15 @@
package main
import (
_ "practice_Go/internal/packed"
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
"github.com/gogf/gf/v2/os/gctx"
"practice_Go/internal/cmd"
)
func main() {
cmd.Main.Run(gctx.GetInitCtx())
}

0
demo/manifest/deploy/kustomize/base/deployment.yaml → manifest/deploy/kustomize/base/deployment.yaml

0
demo/manifest/deploy/kustomize/base/kustomization.yaml → manifest/deploy/kustomize/base/kustomization.yaml

0
demo/manifest/deploy/kustomize/base/service.yaml → manifest/deploy/kustomize/base/service.yaml

0
demo/manifest/deploy/kustomize/overlays/develop/configmap.yaml → manifest/deploy/kustomize/overlays/develop/configmap.yaml

0
demo/manifest/deploy/kustomize/overlays/develop/deployment.yaml → manifest/deploy/kustomize/overlays/develop/deployment.yaml

0
demo/manifest/deploy/kustomize/overlays/develop/kustomization.yaml → manifest/deploy/kustomize/overlays/develop/kustomization.yaml

0
demo/manifest/docker/Dockerfile → manifest/docker/Dockerfile

0
demo/manifest/docker/docker.sh → manifest/docker/docker.sh

0
demo/manifest/i18n/.gitkeep → manifest/i18n/.gitkeep

0
demo/manifest/protobuf/.keep-if-necessary → manifest/protobuf/.keep-if-necessary

0
demo/resource/public/html/.gitkeep → resource/public/html/.gitkeep

532
resource/public/html/api.html
File diff suppressed because it is too large
View File

0
demo/resource/public/plugin/.gitkeep → resource/public/plugin/.gitkeep

0
demo/resource/public/resource/css/.gitkeep → resource/public/resource/css/.gitkeep

0
demo/resource/public/resource/image/.gitkeep → resource/public/resource/image/.gitkeep

0
demo/resource/public/resource/js/.gitkeep → resource/public/resource/js/.gitkeep

0
demo/resource/template/.gitkeep → resource/template/.gitkeep

0
demo/utility/.gitkeep → utility/.gitkeep

Loading…
Cancel
Save