fix: api descript
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
Name: game-api
|
||||
Host: 0.0.0.0
|
||||
Port: 8888
|
||||
|
||||
Prometheus:
|
||||
Host: 0.0.0.0
|
||||
Port: 4001
|
||||
Path: /metrics
|
||||
|
||||
GameRpcConf:
|
||||
Target: k8s://juwan/game-rpc-svc:8080
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"juwan-backend/app/game/api/internal/config"
|
||||
"juwan-backend/app/game/api/internal/handler"
|
||||
"juwan-backend/app/game/api/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/game-api.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf)
|
||||
defer server.Stop()
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
handler.RegisterHandlers(server, ctx)
|
||||
|
||||
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
|
||||
server.Start()
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
rest.RestConf
|
||||
GameRpcConf zrpc.RpcClientConf
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package game
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"juwan-backend/app/game/api/internal/logic/game"
|
||||
"juwan-backend/app/game/api/internal/svc"
|
||||
"juwan-backend/app/game/api/internal/types"
|
||||
)
|
||||
|
||||
// 获取游戏详情
|
||||
func GetGameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.EmptyResp
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := game.NewGetGameLogic(r.Context(), svcCtx)
|
||||
resp := l.GetGame(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package game
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"juwan-backend/app/game/api/internal/logic/game"
|
||||
"juwan-backend/app/game/api/internal/svc"
|
||||
"juwan-backend/app/game/api/internal/types"
|
||||
)
|
||||
|
||||
// 获取游戏列表
|
||||
func ListGamesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.PageReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := game.NewListGamesLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListGames(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
game "juwan-backend/app/game/api/internal/handler/game"
|
||||
"juwan-backend/app/game/api/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 获取游戏列表
|
||||
Method: http.MethodGet,
|
||||
Path: "/",
|
||||
Handler: game.ListGamesHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 获取游戏详情
|
||||
Method: http.MethodGet,
|
||||
Path: "/:id",
|
||||
Handler: game.GetGameHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/v1/games"),
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package game
|
||||
|
||||
import (
|
||||
"context"
|
||||
"juwan-backend/app/game/api/internal/svc"
|
||||
"juwan-backend/app/game/api/internal/types"
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetGameLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 获取游戏详情
|
||||
func NewGetGameLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetGameLogic {
|
||||
return &GetGameLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetGameLogic) GetGame(req *types.GetGameReq) (resp *types.Game) {
|
||||
// todo: add your logic here and delete this line
|
||||
game, err := l.svcCtx.GameRpc.GetGamesById(l.ctx, &pb.GetGamesByIdReq{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return &types.Game{
|
||||
Id: game.Games.Id,
|
||||
Name: game.Games.Name,
|
||||
Icon: game.Games.Icon,
|
||||
Category: game.Games.Category,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package game
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/game/api/internal/svc"
|
||||
"juwan-backend/app/game/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListGamesLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 获取游戏列表
|
||||
func NewListGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListGamesLogic {
|
||||
return &ListGamesLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListGamesLogic) ListGames(req *types.PageReq) (resp *types.GameListResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package svc
|
||||
|
||||
import (
|
||||
"juwan-backend/app/game/api/internal/config"
|
||||
"juwan-backend/app/game/rpc/gamepublic"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
GameRpc gamepublic.GamePublic
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
GameRpc: gamepublic.NewGamePublic(zrpc.MustNewClient(c.GameRpcConf)),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
|
||||
package types
|
||||
|
||||
type EmptyResp struct {
|
||||
}
|
||||
|
||||
type Game struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Icon string `json:"icon"`
|
||||
Category string `json:"category"`
|
||||
}
|
||||
|
||||
type GameListResp struct {
|
||||
Items []Game `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
type GetGameReq struct {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
|
||||
type PageMeta struct {
|
||||
Total int64 `json:"total"`
|
||||
Offset int64 `json:"offset"`
|
||||
Limit int64 `json:"limit"`
|
||||
}
|
||||
|
||||
type PageReq struct {
|
||||
Offset int64 `form:"offset,default=0"`
|
||||
Limit int64 `form:"limit,default=20"`
|
||||
}
|
||||
|
||||
type SimpleUser struct {
|
||||
Id string `json:"id"`
|
||||
Nickname string `json:"nickname"`
|
||||
Avatar string `json:"avatar"`
|
||||
}
|
||||
|
||||
type UserProfile struct {
|
||||
Id string `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Nickname string `json:"nickname"`
|
||||
Avatar string `json:"avatar"`
|
||||
Role string `json:"role"` // consumer, player, owner, admin
|
||||
VerifiedRoles []string `json:"verifiedRoles"`
|
||||
VerificationStatus map[string]string `json:"verificationStatus"`
|
||||
Phone string `json:"phone,optional"`
|
||||
Bio string `json:"bio,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
Name: pb.rpc
|
||||
ListenOn: 0.0.0.0:8080
|
||||
|
||||
|
||||
Prometheus:
|
||||
Host: 0.0.0.0
|
||||
Port: 4001
|
||||
Path: /metrics
|
||||
|
||||
# tcd:
|
||||
# Hosts:
|
||||
# - 127.0.0.1:2379
|
||||
# Key: pb.rpc
|
||||
|
||||
# Target: k8s://juwan/<service name>.<namespace>:8080
|
||||
|
||||
|
||||
#DB:
|
||||
# Master: "postgresql://${PD_USERNAME}:${DB_PASSWORD}@game-db-rw.juwan:${DB_PORT}/${DB_NAME}?sslmode=disable"
|
||||
# Slave: "postgresql://${PD_USERNAME}:${DB_PASSWORD}@game-db-ro.juwan:${DB_PORT}/${DB_NAME}?sslmode=disable"
|
||||
|
||||
DB:
|
||||
Master: "postgresql://${PD_USERNAME}:${DB_PASSWORD}@user-db-rw.juwan:${DB_PORT}/${DB_NAME}?sslmode=disable"
|
||||
Slave: "postgresql://${PD_USERNAME}:${DB_PASSWORD}@user-db-ro.juwan:${DB_PORT}/${DB_NAME}?sslmode=disable"
|
||||
|
||||
|
||||
CacheConf:
|
||||
- Host: "${REDIS_M_HOST}"
|
||||
Type: node
|
||||
Pass: "${REDIS_PASSWORD}"
|
||||
User: "default"
|
||||
- Host: "${REDIS_S_HOST}"
|
||||
Type: node
|
||||
Pass: "${REDIS_PASSWORD}"
|
||||
User: "default"
|
||||
|
||||
Log:
|
||||
Level: info
|
||||
@@ -0,0 +1,288 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
// Source: game.proto
|
||||
|
||||
package gamepublic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
AddGamesReq = pb.AddGamesReq
|
||||
AddGamesResp = pb.AddGamesResp
|
||||
AddPlayerServicesReq = pb.AddPlayerServicesReq
|
||||
AddPlayerServicesResp = pb.AddPlayerServicesResp
|
||||
AddPlayersReq = pb.AddPlayersReq
|
||||
AddPlayersResp = pb.AddPlayersResp
|
||||
AddShopInvitationsReq = pb.AddShopInvitationsReq
|
||||
AddShopInvitationsResp = pb.AddShopInvitationsResp
|
||||
AddShopPlayersReq = pb.AddShopPlayersReq
|
||||
AddShopPlayersResp = pb.AddShopPlayersResp
|
||||
AddShopsReq = pb.AddShopsReq
|
||||
AddShopsResp = pb.AddShopsResp
|
||||
DelGamesReq = pb.DelGamesReq
|
||||
DelGamesResp = pb.DelGamesResp
|
||||
DelPlayerServicesReq = pb.DelPlayerServicesReq
|
||||
DelPlayerServicesResp = pb.DelPlayerServicesResp
|
||||
DelPlayersReq = pb.DelPlayersReq
|
||||
DelPlayersResp = pb.DelPlayersResp
|
||||
DelShopInvitationsReq = pb.DelShopInvitationsReq
|
||||
DelShopInvitationsResp = pb.DelShopInvitationsResp
|
||||
DelShopPlayersReq = pb.DelShopPlayersReq
|
||||
DelShopPlayersResp = pb.DelShopPlayersResp
|
||||
DelShopsReq = pb.DelShopsReq
|
||||
DelShopsResp = pb.DelShopsResp
|
||||
Games = pb.Games
|
||||
GetGamesByIdReq = pb.GetGamesByIdReq
|
||||
GetGamesByIdResp = pb.GetGamesByIdResp
|
||||
GetPlayerServicesByIdReq = pb.GetPlayerServicesByIdReq
|
||||
GetPlayerServicesByIdResp = pb.GetPlayerServicesByIdResp
|
||||
GetPlayersByIdReq = pb.GetPlayersByIdReq
|
||||
GetPlayersByIdResp = pb.GetPlayersByIdResp
|
||||
GetShopInvitationsByIdReq = pb.GetShopInvitationsByIdReq
|
||||
GetShopInvitationsByIdResp = pb.GetShopInvitationsByIdResp
|
||||
GetShopPlayersByIdReq = pb.GetShopPlayersByIdReq
|
||||
GetShopPlayersByIdResp = pb.GetShopPlayersByIdResp
|
||||
GetShopsByIdReq = pb.GetShopsByIdReq
|
||||
GetShopsByIdResp = pb.GetShopsByIdResp
|
||||
PlayerServices = pb.PlayerServices
|
||||
Players = pb.Players
|
||||
SearchGamesReq = pb.SearchGamesReq
|
||||
SearchGamesResp = pb.SearchGamesResp
|
||||
SearchPlayerServicesReq = pb.SearchPlayerServicesReq
|
||||
SearchPlayerServicesResp = pb.SearchPlayerServicesResp
|
||||
SearchPlayersReq = pb.SearchPlayersReq
|
||||
SearchPlayersResp = pb.SearchPlayersResp
|
||||
SearchShopInvitationsReq = pb.SearchShopInvitationsReq
|
||||
SearchShopInvitationsResp = pb.SearchShopInvitationsResp
|
||||
SearchShopPlayersReq = pb.SearchShopPlayersReq
|
||||
SearchShopPlayersResp = pb.SearchShopPlayersResp
|
||||
SearchShopsReq = pb.SearchShopsReq
|
||||
SearchShopsResp = pb.SearchShopsResp
|
||||
ShopInvitations = pb.ShopInvitations
|
||||
ShopPlayers = pb.ShopPlayers
|
||||
Shops = pb.Shops
|
||||
UpdateGamesReq = pb.UpdateGamesReq
|
||||
UpdateGamesResp = pb.UpdateGamesResp
|
||||
UpdatePlayerServicesReq = pb.UpdatePlayerServicesReq
|
||||
UpdatePlayerServicesResp = pb.UpdatePlayerServicesResp
|
||||
UpdatePlayersReq = pb.UpdatePlayersReq
|
||||
UpdatePlayersResp = pb.UpdatePlayersResp
|
||||
UpdateShopInvitationsReq = pb.UpdateShopInvitationsReq
|
||||
UpdateShopInvitationsResp = pb.UpdateShopInvitationsResp
|
||||
UpdateShopPlayersReq = pb.UpdateShopPlayersReq
|
||||
UpdateShopPlayersResp = pb.UpdateShopPlayersResp
|
||||
UpdateShopsReq = pb.UpdateShopsReq
|
||||
UpdateShopsResp = pb.UpdateShopsResp
|
||||
|
||||
GamePublic interface {
|
||||
// -----------------------games-----------------------
|
||||
AddGames(ctx context.Context, in *AddGamesReq, opts ...grpc.CallOption) (*AddGamesResp, error)
|
||||
UpdateGames(ctx context.Context, in *UpdateGamesReq, opts ...grpc.CallOption) (*UpdateGamesResp, error)
|
||||
DelGames(ctx context.Context, in *DelGamesReq, opts ...grpc.CallOption) (*DelGamesResp, error)
|
||||
GetGamesById(ctx context.Context, in *GetGamesByIdReq, opts ...grpc.CallOption) (*GetGamesByIdResp, error)
|
||||
SearchGames(ctx context.Context, in *SearchGamesReq, opts ...grpc.CallOption) (*SearchGamesResp, error)
|
||||
// -----------------------playerServices-----------------------
|
||||
AddPlayerServices(ctx context.Context, in *AddPlayerServicesReq, opts ...grpc.CallOption) (*AddPlayerServicesResp, error)
|
||||
UpdatePlayerServices(ctx context.Context, in *UpdatePlayerServicesReq, opts ...grpc.CallOption) (*UpdatePlayerServicesResp, error)
|
||||
DelPlayerServices(ctx context.Context, in *DelPlayerServicesReq, opts ...grpc.CallOption) (*DelPlayerServicesResp, error)
|
||||
GetPlayerServicesById(ctx context.Context, in *GetPlayerServicesByIdReq, opts ...grpc.CallOption) (*GetPlayerServicesByIdResp, error)
|
||||
SearchPlayerServices(ctx context.Context, in *SearchPlayerServicesReq, opts ...grpc.CallOption) (*SearchPlayerServicesResp, error)
|
||||
// -----------------------players-----------------------
|
||||
AddPlayers(ctx context.Context, in *AddPlayersReq, opts ...grpc.CallOption) (*AddPlayersResp, error)
|
||||
UpdatePlayers(ctx context.Context, in *UpdatePlayersReq, opts ...grpc.CallOption) (*UpdatePlayersResp, error)
|
||||
DelPlayers(ctx context.Context, in *DelPlayersReq, opts ...grpc.CallOption) (*DelPlayersResp, error)
|
||||
GetPlayersById(ctx context.Context, in *GetPlayersByIdReq, opts ...grpc.CallOption) (*GetPlayersByIdResp, error)
|
||||
SearchPlayers(ctx context.Context, in *SearchPlayersReq, opts ...grpc.CallOption) (*SearchPlayersResp, error)
|
||||
// -----------------------shopInvitations-----------------------
|
||||
AddShopInvitations(ctx context.Context, in *AddShopInvitationsReq, opts ...grpc.CallOption) (*AddShopInvitationsResp, error)
|
||||
UpdateShopInvitations(ctx context.Context, in *UpdateShopInvitationsReq, opts ...grpc.CallOption) (*UpdateShopInvitationsResp, error)
|
||||
DelShopInvitations(ctx context.Context, in *DelShopInvitationsReq, opts ...grpc.CallOption) (*DelShopInvitationsResp, error)
|
||||
GetShopInvitationsById(ctx context.Context, in *GetShopInvitationsByIdReq, opts ...grpc.CallOption) (*GetShopInvitationsByIdResp, error)
|
||||
SearchShopInvitations(ctx context.Context, in *SearchShopInvitationsReq, opts ...grpc.CallOption) (*SearchShopInvitationsResp, error)
|
||||
// -----------------------shopPlayers-----------------------
|
||||
AddShopPlayers(ctx context.Context, in *AddShopPlayersReq, opts ...grpc.CallOption) (*AddShopPlayersResp, error)
|
||||
UpdateShopPlayers(ctx context.Context, in *UpdateShopPlayersReq, opts ...grpc.CallOption) (*UpdateShopPlayersResp, error)
|
||||
DelShopPlayers(ctx context.Context, in *DelShopPlayersReq, opts ...grpc.CallOption) (*DelShopPlayersResp, error)
|
||||
GetShopPlayersById(ctx context.Context, in *GetShopPlayersByIdReq, opts ...grpc.CallOption) (*GetShopPlayersByIdResp, error)
|
||||
SearchShopPlayers(ctx context.Context, in *SearchShopPlayersReq, opts ...grpc.CallOption) (*SearchShopPlayersResp, error)
|
||||
// -----------------------shops-----------------------
|
||||
AddShops(ctx context.Context, in *AddShopsReq, opts ...grpc.CallOption) (*AddShopsResp, error)
|
||||
UpdateShops(ctx context.Context, in *UpdateShopsReq, opts ...grpc.CallOption) (*UpdateShopsResp, error)
|
||||
DelShops(ctx context.Context, in *DelShopsReq, opts ...grpc.CallOption) (*DelShopsResp, error)
|
||||
GetShopsById(ctx context.Context, in *GetShopsByIdReq, opts ...grpc.CallOption) (*GetShopsByIdResp, error)
|
||||
SearchShops(ctx context.Context, in *SearchShopsReq, opts ...grpc.CallOption) (*SearchShopsResp, error)
|
||||
}
|
||||
|
||||
defaultGamePublic struct {
|
||||
cli zrpc.Client
|
||||
}
|
||||
)
|
||||
|
||||
func NewGamePublic(cli zrpc.Client) GamePublic {
|
||||
return &defaultGamePublic{
|
||||
cli: cli,
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------games-----------------------
|
||||
func (m *defaultGamePublic) AddGames(ctx context.Context, in *AddGamesReq, opts ...grpc.CallOption) (*AddGamesResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.AddGames(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) UpdateGames(ctx context.Context, in *UpdateGamesReq, opts ...grpc.CallOption) (*UpdateGamesResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.UpdateGames(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) DelGames(ctx context.Context, in *DelGamesReq, opts ...grpc.CallOption) (*DelGamesResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.DelGames(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) GetGamesById(ctx context.Context, in *GetGamesByIdReq, opts ...grpc.CallOption) (*GetGamesByIdResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.GetGamesById(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) SearchGames(ctx context.Context, in *SearchGamesReq, opts ...grpc.CallOption) (*SearchGamesResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.SearchGames(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// -----------------------playerServices-----------------------
|
||||
func (m *defaultGamePublic) AddPlayerServices(ctx context.Context, in *AddPlayerServicesReq, opts ...grpc.CallOption) (*AddPlayerServicesResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.AddPlayerServices(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) UpdatePlayerServices(ctx context.Context, in *UpdatePlayerServicesReq, opts ...grpc.CallOption) (*UpdatePlayerServicesResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.UpdatePlayerServices(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) DelPlayerServices(ctx context.Context, in *DelPlayerServicesReq, opts ...grpc.CallOption) (*DelPlayerServicesResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.DelPlayerServices(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) GetPlayerServicesById(ctx context.Context, in *GetPlayerServicesByIdReq, opts ...grpc.CallOption) (*GetPlayerServicesByIdResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.GetPlayerServicesById(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) SearchPlayerServices(ctx context.Context, in *SearchPlayerServicesReq, opts ...grpc.CallOption) (*SearchPlayerServicesResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.SearchPlayerServices(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// -----------------------players-----------------------
|
||||
func (m *defaultGamePublic) AddPlayers(ctx context.Context, in *AddPlayersReq, opts ...grpc.CallOption) (*AddPlayersResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.AddPlayers(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) UpdatePlayers(ctx context.Context, in *UpdatePlayersReq, opts ...grpc.CallOption) (*UpdatePlayersResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.UpdatePlayers(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) DelPlayers(ctx context.Context, in *DelPlayersReq, opts ...grpc.CallOption) (*DelPlayersResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.DelPlayers(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) GetPlayersById(ctx context.Context, in *GetPlayersByIdReq, opts ...grpc.CallOption) (*GetPlayersByIdResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.GetPlayersById(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) SearchPlayers(ctx context.Context, in *SearchPlayersReq, opts ...grpc.CallOption) (*SearchPlayersResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.SearchPlayers(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// -----------------------shopInvitations-----------------------
|
||||
func (m *defaultGamePublic) AddShopInvitations(ctx context.Context, in *AddShopInvitationsReq, opts ...grpc.CallOption) (*AddShopInvitationsResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.AddShopInvitations(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) UpdateShopInvitations(ctx context.Context, in *UpdateShopInvitationsReq, opts ...grpc.CallOption) (*UpdateShopInvitationsResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.UpdateShopInvitations(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) DelShopInvitations(ctx context.Context, in *DelShopInvitationsReq, opts ...grpc.CallOption) (*DelShopInvitationsResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.DelShopInvitations(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) GetShopInvitationsById(ctx context.Context, in *GetShopInvitationsByIdReq, opts ...grpc.CallOption) (*GetShopInvitationsByIdResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.GetShopInvitationsById(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) SearchShopInvitations(ctx context.Context, in *SearchShopInvitationsReq, opts ...grpc.CallOption) (*SearchShopInvitationsResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.SearchShopInvitations(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// -----------------------shopPlayers-----------------------
|
||||
func (m *defaultGamePublic) AddShopPlayers(ctx context.Context, in *AddShopPlayersReq, opts ...grpc.CallOption) (*AddShopPlayersResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.AddShopPlayers(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) UpdateShopPlayers(ctx context.Context, in *UpdateShopPlayersReq, opts ...grpc.CallOption) (*UpdateShopPlayersResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.UpdateShopPlayers(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) DelShopPlayers(ctx context.Context, in *DelShopPlayersReq, opts ...grpc.CallOption) (*DelShopPlayersResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.DelShopPlayers(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) GetShopPlayersById(ctx context.Context, in *GetShopPlayersByIdReq, opts ...grpc.CallOption) (*GetShopPlayersByIdResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.GetShopPlayersById(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) SearchShopPlayers(ctx context.Context, in *SearchShopPlayersReq, opts ...grpc.CallOption) (*SearchShopPlayersResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.SearchShopPlayers(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// -----------------------shops-----------------------
|
||||
func (m *defaultGamePublic) AddShops(ctx context.Context, in *AddShopsReq, opts ...grpc.CallOption) (*AddShopsResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.AddShops(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) UpdateShops(ctx context.Context, in *UpdateShopsReq, opts ...grpc.CallOption) (*UpdateShopsResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.UpdateShops(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) DelShops(ctx context.Context, in *DelShopsReq, opts ...grpc.CallOption) (*DelShopsResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.DelShops(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) GetShopsById(ctx context.Context, in *GetShopsByIdReq, opts ...grpc.CallOption) (*GetShopsByIdResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.GetShopsById(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultGamePublic) SearchShops(ctx context.Context, in *SearchShopsReq, opts ...grpc.CallOption) (*SearchShopsResp, error) {
|
||||
client := pb.NewGamePublicClient(m.cli.Conn())
|
||||
return client.SearchShops(ctx, in, opts...)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/core/stores/cache"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
SnowflakeRpcConf zrpc.RpcClientConf
|
||||
DB struct {
|
||||
Master string
|
||||
Slaves string
|
||||
}
|
||||
CacheConf cache.CacheConf
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"juwan-backend/app/snowflake/rpc/snowflake"
|
||||
|
||||
"juwan-backend/app/game/rpc/internal/svc"
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AddGamesLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewAddGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddGamesLogic {
|
||||
return &AddGamesLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------games-----------------------
|
||||
func (l *AddGamesLogic) AddGames(in *pb.AddGamesReq) (*pb.AddGamesResp, error) {
|
||||
idResp, err := l.svcCtx.Snowflake.NextId(l.ctx, &snowflake.NextIdReq{})
|
||||
if err != nil {
|
||||
logx.Errorf("AddGamesLogic.addGames err:%v", err)
|
||||
return nil, errors.New("create game id failed")
|
||||
}
|
||||
_, err = l.svcCtx.GameModelRW.Games.Create().
|
||||
SetID(idResp.Id).
|
||||
SetName(in.Name).
|
||||
SetIcon(in.Icon).
|
||||
SetCategory(in.Category).
|
||||
SetSortOrder(int(in.SortOrder)).
|
||||
Save(l.ctx)
|
||||
if err != nil {
|
||||
logx.Errorf("AddGamesLogic.addGames err:%v", err)
|
||||
return nil, errors.New("add game failed")
|
||||
}
|
||||
|
||||
return &pb.AddGamesResp{}, nil
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
type AddGamesReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` //name
|
||||
Icon string `protobuf:"bytes,2,opt,name=icon,proto3" json:"icon,omitempty"` //icon
|
||||
Category string `protobuf:"bytes,3,opt,name=category,proto3" json:"category,omitempty"` //category
|
||||
SortOrder int64 `protobuf:"varint,4,opt,name=sortOrder,proto3" json:"sortOrder,omitempty"` //sortOrder
|
||||
IsActive bool `protobuf:"varint,5,opt,name=isActive,proto3" json:"isActive,omitempty"` //isActive
|
||||
CreatedAt int64 `protobuf:"varint,6,opt,name=createdAt,proto3" json:"createdAt,omitempty"` //createdAt
|
||||
UpdatedAt int64 `protobuf:"varint,7,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` //updatedAt
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,33 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"juwan-backend/app/game/rpc/internal/svc"
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DelGamesLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDelGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DelGamesLogic {
|
||||
return &DelGamesLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DelGamesLogic) DelGames(in *pb.DelGamesReq) (*pb.DelGamesResp, error) {
|
||||
err := l.svcCtx.GameModelRW.Games.DeleteOneID(in.Id).Exec(l.ctx)
|
||||
if err != nil {
|
||||
logx.Errorf("delete games failed, %s", err.Error())
|
||||
return nil, errors.New("delete games failed")
|
||||
}
|
||||
return &pb.DelGamesResp{}, nil
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"juwan-backend/app/game/rpc/internal/models/games"
|
||||
|
||||
"juwan-backend/app/game/rpc/internal/svc"
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetGamesByIdLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetGamesByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetGamesByIdLogic {
|
||||
return &GetGamesByIdLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetGamesByIdLogic) GetGamesById(in *pb.GetGamesByIdReq) (*pb.GetGamesByIdResp, error) {
|
||||
game, err := l.svcCtx.GameModelRO.Games.Query().Where(games.IDEQ(in.Id)).First(l.ctx)
|
||||
if err != nil {
|
||||
logx.WithContext(l.ctx).Errorf("GetGamesByIdLogic err: %v", err)
|
||||
return nil, errors.New("get games by id failed")
|
||||
}
|
||||
pbGame := pb.Games{}
|
||||
err = copier.Copy(&pbGame, &game)
|
||||
if err != nil {
|
||||
logx.WithContext(l.ctx).Errorf("GetGamesByIdLogic copier err: %v", err)
|
||||
return nil, errors.New("get games by id failed")
|
||||
}
|
||||
pbGame.CreatedAt = game.CreatedAt.Unix()
|
||||
pbGame.UpdatedAt = game.UpdatedAt.Unix()
|
||||
return &pb.GetGamesByIdResp{
|
||||
Games: &pbGame,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"juwan-backend/app/game/rpc/internal/models/games"
|
||||
"juwan-backend/app/game/rpc/internal/models/predicate"
|
||||
|
||||
"juwan-backend/app/game/rpc/internal/svc"
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SearchGamesLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewSearchGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SearchGamesLogic {
|
||||
return &SearchGamesLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *SearchGamesLogic) SearchGames(in *pb.SearchGamesReq) (*pb.SearchGamesResp, error) {
|
||||
if in.Limit > 1000 {
|
||||
return nil, errors.New("limit too large")
|
||||
}
|
||||
|
||||
preds := make([]predicate.Games, 0, 8)
|
||||
if in.IdOpt != nil {
|
||||
preds = append(preds, games.IDEQ(*in.IdOpt))
|
||||
} else if in.Id != 0 {
|
||||
preds = append(preds, games.IDEQ(in.Id))
|
||||
}
|
||||
if in.NameOpt != nil {
|
||||
if *in.NameOpt != "" {
|
||||
preds = append(preds, games.NameContainsFold(*in.NameOpt))
|
||||
}
|
||||
} else if in.Name != "" {
|
||||
preds = append(preds, games.NameContainsFold(in.Name))
|
||||
}
|
||||
if in.IconOpt != nil {
|
||||
if *in.IconOpt != "" {
|
||||
preds = append(preds, games.IconContainsFold(*in.IconOpt))
|
||||
}
|
||||
} else if in.Icon != "" {
|
||||
preds = append(preds, games.IconContainsFold(in.Icon))
|
||||
}
|
||||
if in.CategoryOpt != nil {
|
||||
if *in.CategoryOpt != "" {
|
||||
preds = append(preds, games.CategoryContainsFold(*in.CategoryOpt))
|
||||
}
|
||||
} else if in.Category != "" {
|
||||
preds = append(preds, games.CategoryContainsFold(in.Category))
|
||||
}
|
||||
if in.SortOrderOpt != nil {
|
||||
preds = append(preds, games.SortOrderEQ(int(*in.SortOrderOpt)))
|
||||
} else if in.SortOrder != 0 {
|
||||
preds = append(preds, games.SortOrderEQ(int(in.SortOrder)))
|
||||
}
|
||||
if in.IsActiveOpt != nil {
|
||||
preds = append(preds, games.IsActiveEQ(*in.IsActiveOpt))
|
||||
} else if in.IsActive {
|
||||
preds = append(preds, games.IsActiveEQ(true))
|
||||
}
|
||||
|
||||
query := l.svcCtx.GameModelRO.Games.Query()
|
||||
if len(preds) > 0 {
|
||||
if in.MatchMode == pb.MatchMode_MATCH_MODE_AND {
|
||||
query = query.Where(games.And(preds...))
|
||||
} else {
|
||||
query = query.Where(games.Or(preds...))
|
||||
}
|
||||
}
|
||||
|
||||
all, err := query.
|
||||
Offset(int(in.Page * in.Limit)).
|
||||
Limit(int(in.Limit)).
|
||||
All(l.ctx)
|
||||
if err != nil {
|
||||
logx.Errorf("search games failed, %s", err.Error())
|
||||
return nil, errors.New("search games failed")
|
||||
}
|
||||
|
||||
list := make([]*pb.Games, 0, len(all))
|
||||
for _, v := range all {
|
||||
temp := &pb.Games{}
|
||||
err = copier.Copy(temp, &v)
|
||||
if err != nil {
|
||||
logx.Errorf("search games failed, %s", err.Error())
|
||||
continue
|
||||
}
|
||||
temp.CreatedAt = v.CreatedAt.Unix()
|
||||
temp.UpdatedAt = v.UpdatedAt.Unix()
|
||||
list = append(list, temp)
|
||||
}
|
||||
|
||||
return &pb.SearchGamesResp{
|
||||
Games: list,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"juwan-backend/app/game/rpc/internal/svc"
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UpdateGamesLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUpdateGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateGamesLogic {
|
||||
return &UpdateGamesLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateGamesLogic) UpdateGames(in *pb.UpdateGamesReq) (*pb.UpdateGamesResp, error) {
|
||||
update := l.svcCtx.GameModelRW.Games.UpdateOneID(in.Id)
|
||||
updated := false
|
||||
|
||||
if in.NameOpt != nil {
|
||||
update.SetNillableName(in.NameOpt)
|
||||
updated = true
|
||||
} else if in.Name != "" {
|
||||
update.SetName(in.Name)
|
||||
updated = true
|
||||
}
|
||||
|
||||
if in.IconOpt != nil {
|
||||
update.SetNillableIcon(in.IconOpt)
|
||||
updated = true
|
||||
} else if in.Icon != "" {
|
||||
update.SetIcon(in.Icon)
|
||||
updated = true
|
||||
}
|
||||
|
||||
if in.CategoryOpt != nil {
|
||||
update.SetNillableCategory(in.CategoryOpt)
|
||||
updated = true
|
||||
} else if in.Category != "" {
|
||||
update.SetCategory(in.Category)
|
||||
updated = true
|
||||
}
|
||||
|
||||
if in.SortOrderOpt != nil {
|
||||
sortOrder := int(*in.SortOrderOpt)
|
||||
update.SetNillableSortOrder(&sortOrder)
|
||||
updated = true
|
||||
} else if in.SortOrder != 0 {
|
||||
sortOrder := int(in.SortOrder)
|
||||
update.SetSortOrder(sortOrder)
|
||||
updated = true
|
||||
}
|
||||
|
||||
if in.IsActiveOpt != nil {
|
||||
update.SetNillableIsActive(in.IsActiveOpt)
|
||||
updated = true
|
||||
} else if in.IsActive {
|
||||
update.SetIsActive(true)
|
||||
updated = true
|
||||
}
|
||||
|
||||
if !updated {
|
||||
return nil, errors.New("no fields to update")
|
||||
}
|
||||
|
||||
update.SetUpdatedAt(time.Now())
|
||||
if err := update.Exec(l.ctx); err != nil {
|
||||
logx.WithContext(l.ctx).Errorf("UpdateGamesLogic err: %v", err)
|
||||
return nil, errors.New("update games failed")
|
||||
}
|
||||
|
||||
return &pb.UpdateGamesResp{}, nil
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// Games holds the schema definition for the Games entity.
|
||||
type Games struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the Games.
|
||||
func (Games) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.String("name").MaxLen(100).Unique(),
|
||||
field.String("icon"),
|
||||
field.String("category").MaxLen(50),
|
||||
field.Int("sort_order").Default(0),
|
||||
field.Bool("is_active").Optional().Default(true),
|
||||
field.Time("created_at").Default(time.Now).Immutable(),
|
||||
field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Games.
|
||||
func (Games) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
// Source: game.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/game/rpc/internal/logic"
|
||||
"juwan-backend/app/game/rpc/internal/svc"
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
)
|
||||
|
||||
type GamePublicServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
pb.UnimplementedGamePublicServer
|
||||
}
|
||||
|
||||
func NewGamePublicServer(svcCtx *svc.ServiceContext) *GamePublicServer {
|
||||
return &GamePublicServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------games-----------------------
|
||||
func (s *GamePublicServer) AddGames(ctx context.Context, in *pb.AddGamesReq) (*pb.AddGamesResp, error) {
|
||||
l := logic.NewAddGamesLogic(ctx, s.svcCtx)
|
||||
return l.AddGames(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) UpdateGames(ctx context.Context, in *pb.UpdateGamesReq) (*pb.UpdateGamesResp, error) {
|
||||
l := logic.NewUpdateGamesLogic(ctx, s.svcCtx)
|
||||
return l.UpdateGames(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) DelGames(ctx context.Context, in *pb.DelGamesReq) (*pb.DelGamesResp, error) {
|
||||
l := logic.NewDelGamesLogic(ctx, s.svcCtx)
|
||||
return l.DelGames(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) GetGamesById(ctx context.Context, in *pb.GetGamesByIdReq) (*pb.GetGamesByIdResp, error) {
|
||||
l := logic.NewGetGamesByIdLogic(ctx, s.svcCtx)
|
||||
return l.GetGamesById(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) SearchGames(ctx context.Context, in *pb.SearchGamesReq) (*pb.SearchGamesResp, error) {
|
||||
l := logic.NewSearchGamesLogic(ctx, s.svcCtx)
|
||||
return l.SearchGames(in)
|
||||
}
|
||||
|
||||
// -----------------------playerServices-----------------------
|
||||
func (s *GamePublicServer) AddPlayerServices(ctx context.Context, in *pb.AddPlayerServicesReq) (*pb.AddPlayerServicesResp, error) {
|
||||
l := logic.NewAddPlayerServicesLogic(ctx, s.svcCtx)
|
||||
return l.AddPlayerServices(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) UpdatePlayerServices(ctx context.Context, in *pb.UpdatePlayerServicesReq) (*pb.UpdatePlayerServicesResp, error) {
|
||||
l := logic.NewUpdatePlayerServicesLogic(ctx, s.svcCtx)
|
||||
return l.UpdatePlayerServices(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) DelPlayerServices(ctx context.Context, in *pb.DelPlayerServicesReq) (*pb.DelPlayerServicesResp, error) {
|
||||
l := logic.NewDelPlayerServicesLogic(ctx, s.svcCtx)
|
||||
return l.DelPlayerServices(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) GetPlayerServicesById(ctx context.Context, in *pb.GetPlayerServicesByIdReq) (*pb.GetPlayerServicesByIdResp, error) {
|
||||
l := logic.NewGetPlayerServicesByIdLogic(ctx, s.svcCtx)
|
||||
return l.GetPlayerServicesById(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) SearchPlayerServices(ctx context.Context, in *pb.SearchPlayerServicesReq) (*pb.SearchPlayerServicesResp, error) {
|
||||
l := logic.NewSearchPlayerServicesLogic(ctx, s.svcCtx)
|
||||
return l.SearchPlayerServices(in)
|
||||
}
|
||||
|
||||
// -----------------------players-----------------------
|
||||
func (s *GamePublicServer) AddPlayers(ctx context.Context, in *pb.AddPlayersReq) (*pb.AddPlayersResp, error) {
|
||||
l := logic.NewAddPlayersLogic(ctx, s.svcCtx)
|
||||
return l.AddPlayers(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) UpdatePlayers(ctx context.Context, in *pb.UpdatePlayersReq) (*pb.UpdatePlayersResp, error) {
|
||||
l := logic.NewUpdatePlayersLogic(ctx, s.svcCtx)
|
||||
return l.UpdatePlayers(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) DelPlayers(ctx context.Context, in *pb.DelPlayersReq) (*pb.DelPlayersResp, error) {
|
||||
l := logic.NewDelPlayersLogic(ctx, s.svcCtx)
|
||||
return l.DelPlayers(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) GetPlayersById(ctx context.Context, in *pb.GetPlayersByIdReq) (*pb.GetPlayersByIdResp, error) {
|
||||
l := logic.NewGetPlayersByIdLogic(ctx, s.svcCtx)
|
||||
return l.GetPlayersById(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) SearchPlayers(ctx context.Context, in *pb.SearchPlayersReq) (*pb.SearchPlayersResp, error) {
|
||||
l := logic.NewSearchPlayersLogic(ctx, s.svcCtx)
|
||||
return l.SearchPlayers(in)
|
||||
}
|
||||
|
||||
// -----------------------shopInvitations-----------------------
|
||||
func (s *GamePublicServer) AddShopInvitations(ctx context.Context, in *pb.AddShopInvitationsReq) (*pb.AddShopInvitationsResp, error) {
|
||||
l := logic.NewAddShopInvitationsLogic(ctx, s.svcCtx)
|
||||
return l.AddShopInvitations(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) UpdateShopInvitations(ctx context.Context, in *pb.UpdateShopInvitationsReq) (*pb.UpdateShopInvitationsResp, error) {
|
||||
l := logic.NewUpdateShopInvitationsLogic(ctx, s.svcCtx)
|
||||
return l.UpdateShopInvitations(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) DelShopInvitations(ctx context.Context, in *pb.DelShopInvitationsReq) (*pb.DelShopInvitationsResp, error) {
|
||||
l := logic.NewDelShopInvitationsLogic(ctx, s.svcCtx)
|
||||
return l.DelShopInvitations(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) GetShopInvitationsById(ctx context.Context, in *pb.GetShopInvitationsByIdReq) (*pb.GetShopInvitationsByIdResp, error) {
|
||||
l := logic.NewGetShopInvitationsByIdLogic(ctx, s.svcCtx)
|
||||
return l.GetShopInvitationsById(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) SearchShopInvitations(ctx context.Context, in *pb.SearchShopInvitationsReq) (*pb.SearchShopInvitationsResp, error) {
|
||||
l := logic.NewSearchShopInvitationsLogic(ctx, s.svcCtx)
|
||||
return l.SearchShopInvitations(in)
|
||||
}
|
||||
|
||||
// -----------------------shopPlayers-----------------------
|
||||
func (s *GamePublicServer) AddShopPlayers(ctx context.Context, in *pb.AddShopPlayersReq) (*pb.AddShopPlayersResp, error) {
|
||||
l := logic.NewAddShopPlayersLogic(ctx, s.svcCtx)
|
||||
return l.AddShopPlayers(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) UpdateShopPlayers(ctx context.Context, in *pb.UpdateShopPlayersReq) (*pb.UpdateShopPlayersResp, error) {
|
||||
l := logic.NewUpdateShopPlayersLogic(ctx, s.svcCtx)
|
||||
return l.UpdateShopPlayers(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) DelShopPlayers(ctx context.Context, in *pb.DelShopPlayersReq) (*pb.DelShopPlayersResp, error) {
|
||||
l := logic.NewDelShopPlayersLogic(ctx, s.svcCtx)
|
||||
return l.DelShopPlayers(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) GetShopPlayersById(ctx context.Context, in *pb.GetShopPlayersByIdReq) (*pb.GetShopPlayersByIdResp, error) {
|
||||
l := logic.NewGetShopPlayersByIdLogic(ctx, s.svcCtx)
|
||||
return l.GetShopPlayersById(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) SearchShopPlayers(ctx context.Context, in *pb.SearchShopPlayersReq) (*pb.SearchShopPlayersResp, error) {
|
||||
l := logic.NewSearchShopPlayersLogic(ctx, s.svcCtx)
|
||||
return l.SearchShopPlayers(in)
|
||||
}
|
||||
|
||||
// -----------------------shops-----------------------
|
||||
func (s *GamePublicServer) AddShops(ctx context.Context, in *pb.AddShopsReq) (*pb.AddShopsResp, error) {
|
||||
l := logic.NewAddShopsLogic(ctx, s.svcCtx)
|
||||
return l.AddShops(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) UpdateShops(ctx context.Context, in *pb.UpdateShopsReq) (*pb.UpdateShopsResp, error) {
|
||||
l := logic.NewUpdateShopsLogic(ctx, s.svcCtx)
|
||||
return l.UpdateShops(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) DelShops(ctx context.Context, in *pb.DelShopsReq) (*pb.DelShopsResp, error) {
|
||||
l := logic.NewDelShopsLogic(ctx, s.svcCtx)
|
||||
return l.DelShops(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) GetShopsById(ctx context.Context, in *pb.GetShopsByIdReq) (*pb.GetShopsByIdResp, error) {
|
||||
l := logic.NewGetShopsByIdLogic(ctx, s.svcCtx)
|
||||
return l.GetShopsById(in)
|
||||
}
|
||||
|
||||
func (s *GamePublicServer) SearchShops(ctx context.Context, in *pb.SearchShopsReq) (*pb.SearchShopsResp, error) {
|
||||
l := logic.NewSearchShopsLogic(ctx, s.svcCtx)
|
||||
return l.SearchShops(in)
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
// Source: game.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/game/rpc/internal/logic"
|
||||
"juwan-backend/app/game/rpc/internal/svc"
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
)
|
||||
|
||||
type PublicServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
pb.UnimplementedPublicServer
|
||||
}
|
||||
|
||||
func NewPublicServer(svcCtx *svc.ServiceContext) *PublicServer {
|
||||
return &PublicServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------games-----------------------
|
||||
func (s *PublicServer) AddGames(ctx context.Context, in *pb.AddGamesReq) (*pb.AddGamesResp, error) {
|
||||
l := logic.NewAddGamesLogic(ctx, s.svcCtx)
|
||||
return l.AddGames(in)
|
||||
}
|
||||
|
||||
func (s *PublicServer) UpdateGames(ctx context.Context, in *pb.UpdateGamesReq) (*pb.UpdateGamesResp, error) {
|
||||
l := logic.NewUpdateGamesLogic(ctx, s.svcCtx)
|
||||
return l.UpdateGames(in)
|
||||
}
|
||||
|
||||
func (s *PublicServer) DelGames(ctx context.Context, in *pb.DelGamesReq) (*pb.DelGamesResp, error) {
|
||||
l := logic.NewDelGamesLogic(ctx, s.svcCtx)
|
||||
return l.DelGames(in)
|
||||
}
|
||||
|
||||
func (s *PublicServer) GetGamesById(ctx context.Context, in *pb.GetGamesByIdReq) (*pb.GetGamesByIdResp, error) {
|
||||
l := logic.NewGetGamesByIdLogic(ctx, s.svcCtx)
|
||||
return l.GetGamesById(in)
|
||||
}
|
||||
|
||||
func (s *PublicServer) SearchGames(ctx context.Context, in *pb.SearchGamesReq) (*pb.SearchGamesResp, error) {
|
||||
l := logic.NewSearchGamesLogic(ctx, s.svcCtx)
|
||||
return l.SearchGames(in)
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"juwan-backend/app/game/rpc/internal/config"
|
||||
"juwan-backend/app/game/rpc/internal/models"
|
||||
"juwan-backend/app/snowflake/rpc/snowflake"
|
||||
"juwan-backend/common/redisx"
|
||||
"juwan-backend/common/snowflakex"
|
||||
"juwan-backend/pkg/adapter"
|
||||
"time"
|
||||
|
||||
"ariga.io/entcache"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
Snowflake snowflake.SnowflakeServiceClient
|
||||
GameModelRW *models.Client
|
||||
GameModelRO *models.Client
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
RWConn, err := sql.Open("pgx", c.DB.Master)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ROConn, err := sql.Open("pgx", c.DB.Slaves)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
redisCluster, err := redisx.ConnectMasterSlaveCluster(c.CacheConf, 5*time.Second)
|
||||
if redisCluster == nil || err != nil {
|
||||
logx.Errorf("failed to connect to Redis cluster: %v", err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
RWDrv := entcache.NewDriver(RWConn, entcache.TTL(30*time.Second), entcache.Levels(adapter.NewRedisCache(redisCluster.Client)))
|
||||
RODrv := entcache.NewDriver(ROConn, entcache.TTL(30*time.Second), entcache.Levels(adapter.NewRedisCache(redisCluster.Client)))
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
GameModelRW: models.NewClient(models.Driver(RWDrv)),
|
||||
GameModelRO: models.NewClient(models.Driver(RODrv)),
|
||||
Snowflake: snowflakex.NewClient(c.SnowflakeRpcConf),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"juwan-backend/app/game/rpc/internal/config"
|
||||
"juwan-backend/app/game/rpc/internal/server"
|
||||
"juwan-backend/app/game/rpc/internal/svc"
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/pb.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
ctx := svc.NewServiceContext(c)
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
pb.RegisterGamePublicServer(grpcServer, server.NewGamePublicServer(ctx))
|
||||
|
||||
if c.Mode == service.DevMode || c.Mode == service.TestMode {
|
||||
reflection.Register(grpcServer)
|
||||
}
|
||||
})
|
||||
defer s.Stop()
|
||||
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
||||
s.Start()
|
||||
}
|
||||
@@ -0,0 +1,847 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v5.29.6
|
||||
// source: game.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// --------------------------------games--------------------------------
|
||||
type Games struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //id
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` //name
|
||||
Icon string `protobuf:"bytes,3,opt,name=icon,proto3" json:"icon,omitempty"` //icon
|
||||
Category string `protobuf:"bytes,4,opt,name=category,proto3" json:"category,omitempty"` //category
|
||||
SortOrder int64 `protobuf:"varint,5,opt,name=sortOrder,proto3" json:"sortOrder,omitempty"` //sortOrder
|
||||
IsActive bool `protobuf:"varint,6,opt,name=isActive,proto3" json:"isActive,omitempty"` //isActive
|
||||
CreatedAt int64 `protobuf:"varint,7,opt,name=createdAt,proto3" json:"createdAt,omitempty"` //createdAt
|
||||
UpdatedAt int64 `protobuf:"varint,8,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` //updatedAt
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Games) Reset() {
|
||||
*x = Games{}
|
||||
mi := &file_game_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Games) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Games) ProtoMessage() {}
|
||||
|
||||
func (x *Games) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Games.ProtoReflect.Descriptor instead.
|
||||
func (*Games) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Games) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Games) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Games) GetIcon() string {
|
||||
if x != nil {
|
||||
return x.Icon
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Games) GetCategory() string {
|
||||
if x != nil {
|
||||
return x.Category
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Games) GetSortOrder() int64 {
|
||||
if x != nil {
|
||||
return x.SortOrder
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Games) GetIsActive() bool {
|
||||
if x != nil {
|
||||
return x.IsActive
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Games) GetCreatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Games) GetUpdatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type AddGamesReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` //name
|
||||
Icon string `protobuf:"bytes,2,opt,name=icon,proto3" json:"icon,omitempty"` //icon
|
||||
Category string `protobuf:"bytes,3,opt,name=category,proto3" json:"category,omitempty"` //category
|
||||
SortOrder int64 `protobuf:"varint,4,opt,name=sortOrder,proto3" json:"sortOrder,omitempty"` //sortOrder
|
||||
IsActive bool `protobuf:"varint,5,opt,name=isActive,proto3" json:"isActive,omitempty"` //isActive
|
||||
CreatedAt int64 `protobuf:"varint,6,opt,name=createdAt,proto3" json:"createdAt,omitempty"` //createdAt
|
||||
UpdatedAt int64 `protobuf:"varint,7,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` //updatedAt
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AddGamesReq) Reset() {
|
||||
*x = AddGamesReq{}
|
||||
mi := &file_game_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AddGamesReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AddGamesReq) ProtoMessage() {}
|
||||
|
||||
func (x *AddGamesReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AddGamesReq.ProtoReflect.Descriptor instead.
|
||||
func (*AddGamesReq) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *AddGamesReq) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddGamesReq) GetIcon() string {
|
||||
if x != nil {
|
||||
return x.Icon
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddGamesReq) GetCategory() string {
|
||||
if x != nil {
|
||||
return x.Category
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddGamesReq) GetSortOrder() int64 {
|
||||
if x != nil {
|
||||
return x.SortOrder
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *AddGamesReq) GetIsActive() bool {
|
||||
if x != nil {
|
||||
return x.IsActive
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *AddGamesReq) GetCreatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *AddGamesReq) GetUpdatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type AddGamesResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AddGamesResp) Reset() {
|
||||
*x = AddGamesResp{}
|
||||
mi := &file_game_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AddGamesResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AddGamesResp) ProtoMessage() {}
|
||||
|
||||
func (x *AddGamesResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AddGamesResp.ProtoReflect.Descriptor instead.
|
||||
func (*AddGamesResp) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
type UpdateGamesReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //id
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` //name
|
||||
Icon string `protobuf:"bytes,3,opt,name=icon,proto3" json:"icon,omitempty"` //icon
|
||||
Category string `protobuf:"bytes,4,opt,name=category,proto3" json:"category,omitempty"` //category
|
||||
SortOrder int64 `protobuf:"varint,5,opt,name=sortOrder,proto3" json:"sortOrder,omitempty"` //sortOrder
|
||||
IsActive bool `protobuf:"varint,6,opt,name=isActive,proto3" json:"isActive,omitempty"` //isActive
|
||||
CreatedAt int64 `protobuf:"varint,7,opt,name=createdAt,proto3" json:"createdAt,omitempty"` //createdAt
|
||||
UpdatedAt int64 `protobuf:"varint,8,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` //updatedAt
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UpdateGamesReq) Reset() {
|
||||
*x = UpdateGamesReq{}
|
||||
mi := &file_game_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UpdateGamesReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateGamesReq) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateGamesReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateGamesReq.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateGamesReq) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *UpdateGamesReq) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdateGamesReq) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UpdateGamesReq) GetIcon() string {
|
||||
if x != nil {
|
||||
return x.Icon
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UpdateGamesReq) GetCategory() string {
|
||||
if x != nil {
|
||||
return x.Category
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UpdateGamesReq) GetSortOrder() int64 {
|
||||
if x != nil {
|
||||
return x.SortOrder
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdateGamesReq) GetIsActive() bool {
|
||||
if x != nil {
|
||||
return x.IsActive
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *UpdateGamesReq) GetCreatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdateGamesReq) GetUpdatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type UpdateGamesResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UpdateGamesResp) Reset() {
|
||||
*x = UpdateGamesResp{}
|
||||
mi := &file_game_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UpdateGamesResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateGamesResp) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateGamesResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateGamesResp.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateGamesResp) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
type DelGamesReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //id
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *DelGamesReq) Reset() {
|
||||
*x = DelGamesReq{}
|
||||
mi := &file_game_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DelGamesReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DelGamesReq) ProtoMessage() {}
|
||||
|
||||
func (x *DelGamesReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DelGamesReq.ProtoReflect.Descriptor instead.
|
||||
func (*DelGamesReq) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *DelGamesReq) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DelGamesResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *DelGamesResp) Reset() {
|
||||
*x = DelGamesResp{}
|
||||
mi := &file_game_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DelGamesResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DelGamesResp) ProtoMessage() {}
|
||||
|
||||
func (x *DelGamesResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DelGamesResp.ProtoReflect.Descriptor instead.
|
||||
func (*DelGamesResp) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
type GetGamesByIdReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //id
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetGamesByIdReq) Reset() {
|
||||
*x = GetGamesByIdReq{}
|
||||
mi := &file_game_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetGamesByIdReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetGamesByIdReq) ProtoMessage() {}
|
||||
|
||||
func (x *GetGamesByIdReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetGamesByIdReq.ProtoReflect.Descriptor instead.
|
||||
func (*GetGamesByIdReq) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *GetGamesByIdReq) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetGamesByIdResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Games *Games `protobuf:"bytes,1,opt,name=games,proto3" json:"games,omitempty"` //games
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetGamesByIdResp) Reset() {
|
||||
*x = GetGamesByIdResp{}
|
||||
mi := &file_game_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetGamesByIdResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetGamesByIdResp) ProtoMessage() {}
|
||||
|
||||
func (x *GetGamesByIdResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetGamesByIdResp.ProtoReflect.Descriptor instead.
|
||||
func (*GetGamesByIdResp) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *GetGamesByIdResp) GetGames() *Games {
|
||||
if x != nil {
|
||||
return x.Games
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SearchGamesReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page
|
||||
Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit
|
||||
Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id
|
||||
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` //name
|
||||
Icon string `protobuf:"bytes,5,opt,name=icon,proto3" json:"icon,omitempty"` //icon
|
||||
Category string `protobuf:"bytes,6,opt,name=category,proto3" json:"category,omitempty"` //category
|
||||
SortOrder int64 `protobuf:"varint,7,opt,name=sortOrder,proto3" json:"sortOrder,omitempty"` //sortOrder
|
||||
IsActive bool `protobuf:"varint,8,opt,name=isActive,proto3" json:"isActive,omitempty"` //isActive
|
||||
CreatedAt int64 `protobuf:"varint,9,opt,name=createdAt,proto3" json:"createdAt,omitempty"` //createdAt
|
||||
UpdatedAt int64 `protobuf:"varint,10,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` //updatedAt
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) Reset() {
|
||||
*x = SearchGamesReq{}
|
||||
mi := &file_game_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SearchGamesReq) ProtoMessage() {}
|
||||
|
||||
func (x *SearchGamesReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SearchGamesReq.ProtoReflect.Descriptor instead.
|
||||
func (*SearchGamesReq) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) GetPage() int64 {
|
||||
if x != nil {
|
||||
return x.Page
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) GetLimit() int64 {
|
||||
if x != nil {
|
||||
return x.Limit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) GetIcon() string {
|
||||
if x != nil {
|
||||
return x.Icon
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) GetCategory() string {
|
||||
if x != nil {
|
||||
return x.Category
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) GetSortOrder() int64 {
|
||||
if x != nil {
|
||||
return x.SortOrder
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) GetIsActive() bool {
|
||||
if x != nil {
|
||||
return x.IsActive
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) GetCreatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *SearchGamesReq) GetUpdatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type SearchGamesResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Games []*Games `protobuf:"bytes,1,rep,name=games,proto3" json:"games,omitempty"` //games
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SearchGamesResp) Reset() {
|
||||
*x = SearchGamesResp{}
|
||||
mi := &file_game_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SearchGamesResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SearchGamesResp) ProtoMessage() {}
|
||||
|
||||
func (x *SearchGamesResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_game_proto_msgTypes[10]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SearchGamesResp.ProtoReflect.Descriptor instead.
|
||||
func (*SearchGamesResp) Descriptor() ([]byte, []int) {
|
||||
return file_game_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *SearchGamesResp) GetGames() []*Games {
|
||||
if x != nil {
|
||||
return x.Games
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_game_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_game_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"game.proto\x12\x02pb\"\xd1\x01\n" +
|
||||
"\x05Games\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
|
||||
"\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" +
|
||||
"\x04icon\x18\x03 \x01(\tR\x04icon\x12\x1a\n" +
|
||||
"\bcategory\x18\x04 \x01(\tR\bcategory\x12\x1c\n" +
|
||||
"\tsortOrder\x18\x05 \x01(\x03R\tsortOrder\x12\x1a\n" +
|
||||
"\bisActive\x18\x06 \x01(\bR\bisActive\x12\x1c\n" +
|
||||
"\tcreatedAt\x18\a \x01(\x03R\tcreatedAt\x12\x1c\n" +
|
||||
"\tupdatedAt\x18\b \x01(\x03R\tupdatedAt\"\xc7\x01\n" +
|
||||
"\vAddGamesReq\x12\x12\n" +
|
||||
"\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +
|
||||
"\x04icon\x18\x02 \x01(\tR\x04icon\x12\x1a\n" +
|
||||
"\bcategory\x18\x03 \x01(\tR\bcategory\x12\x1c\n" +
|
||||
"\tsortOrder\x18\x04 \x01(\x03R\tsortOrder\x12\x1a\n" +
|
||||
"\bisActive\x18\x05 \x01(\bR\bisActive\x12\x1c\n" +
|
||||
"\tcreatedAt\x18\x06 \x01(\x03R\tcreatedAt\x12\x1c\n" +
|
||||
"\tupdatedAt\x18\a \x01(\x03R\tupdatedAt\"\x0e\n" +
|
||||
"\fAddGamesResp\"\xda\x01\n" +
|
||||
"\x0eUpdateGamesReq\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
|
||||
"\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" +
|
||||
"\x04icon\x18\x03 \x01(\tR\x04icon\x12\x1a\n" +
|
||||
"\bcategory\x18\x04 \x01(\tR\bcategory\x12\x1c\n" +
|
||||
"\tsortOrder\x18\x05 \x01(\x03R\tsortOrder\x12\x1a\n" +
|
||||
"\bisActive\x18\x06 \x01(\bR\bisActive\x12\x1c\n" +
|
||||
"\tcreatedAt\x18\a \x01(\x03R\tcreatedAt\x12\x1c\n" +
|
||||
"\tupdatedAt\x18\b \x01(\x03R\tupdatedAt\"\x11\n" +
|
||||
"\x0fUpdateGamesResp\"\x1d\n" +
|
||||
"\vDelGamesReq\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\"\x0e\n" +
|
||||
"\fDelGamesResp\"!\n" +
|
||||
"\x0fGetGamesByIdReq\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\"3\n" +
|
||||
"\x10GetGamesByIdResp\x12\x1f\n" +
|
||||
"\x05games\x18\x01 \x01(\v2\t.pb.GamesR\x05games\"\x84\x02\n" +
|
||||
"\x0eSearchGamesReq\x12\x12\n" +
|
||||
"\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" +
|
||||
"\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" +
|
||||
"\x02id\x18\x03 \x01(\x03R\x02id\x12\x12\n" +
|
||||
"\x04name\x18\x04 \x01(\tR\x04name\x12\x12\n" +
|
||||
"\x04icon\x18\x05 \x01(\tR\x04icon\x12\x1a\n" +
|
||||
"\bcategory\x18\x06 \x01(\tR\bcategory\x12\x1c\n" +
|
||||
"\tsortOrder\x18\a \x01(\x03R\tsortOrder\x12\x1a\n" +
|
||||
"\bisActive\x18\b \x01(\bR\bisActive\x12\x1c\n" +
|
||||
"\tcreatedAt\x18\t \x01(\x03R\tcreatedAt\x12\x1c\n" +
|
||||
"\tupdatedAt\x18\n" +
|
||||
" \x01(\x03R\tupdatedAt\"2\n" +
|
||||
"\x0fSearchGamesResp\x12\x1f\n" +
|
||||
"\x05games\x18\x01 \x03(\v2\t.pb.GamesR\x05games2\x91\x02\n" +
|
||||
"\x06public\x12-\n" +
|
||||
"\bAddGames\x12\x0f.pb.AddGamesReq\x1a\x10.pb.AddGamesResp\x126\n" +
|
||||
"\vUpdateGames\x12\x12.pb.UpdateGamesReq\x1a\x13.pb.UpdateGamesResp\x12-\n" +
|
||||
"\bDelGames\x12\x0f.pb.DelGamesReq\x1a\x10.pb.DelGamesResp\x129\n" +
|
||||
"\fGetGamesById\x12\x13.pb.GetGamesByIdReq\x1a\x14.pb.GetGamesByIdResp\x126\n" +
|
||||
"\vSearchGames\x12\x12.pb.SearchGamesReq\x1a\x13.pb.SearchGamesRespB\x06Z\x04./pbb\x06proto3"
|
||||
|
||||
var (
|
||||
file_game_proto_rawDescOnce sync.Once
|
||||
file_game_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_game_proto_rawDescGZIP() []byte {
|
||||
file_game_proto_rawDescOnce.Do(func() {
|
||||
file_game_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_game_proto_rawDesc), len(file_game_proto_rawDesc)))
|
||||
})
|
||||
return file_game_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_game_proto_goTypes = []any{
|
||||
(*Games)(nil), // 0: pb.Games
|
||||
(*AddGamesReq)(nil), // 1: pb.AddGamesReq
|
||||
(*AddGamesResp)(nil), // 2: pb.AddGamesResp
|
||||
(*UpdateGamesReq)(nil), // 3: pb.UpdateGamesReq
|
||||
(*UpdateGamesResp)(nil), // 4: pb.UpdateGamesResp
|
||||
(*DelGamesReq)(nil), // 5: pb.DelGamesReq
|
||||
(*DelGamesResp)(nil), // 6: pb.DelGamesResp
|
||||
(*GetGamesByIdReq)(nil), // 7: pb.GetGamesByIdReq
|
||||
(*GetGamesByIdResp)(nil), // 8: pb.GetGamesByIdResp
|
||||
(*SearchGamesReq)(nil), // 9: pb.SearchGamesReq
|
||||
(*SearchGamesResp)(nil), // 10: pb.SearchGamesResp
|
||||
}
|
||||
var file_game_proto_depIdxs = []int32{
|
||||
0, // 0: pb.GetGamesByIdResp.games:type_name -> pb.Games
|
||||
0, // 1: pb.SearchGamesResp.games:type_name -> pb.Games
|
||||
1, // 2: pb.public.AddGames:input_type -> pb.AddGamesReq
|
||||
3, // 3: pb.public.UpdateGames:input_type -> pb.UpdateGamesReq
|
||||
5, // 4: pb.public.DelGames:input_type -> pb.DelGamesReq
|
||||
7, // 5: pb.public.GetGamesById:input_type -> pb.GetGamesByIdReq
|
||||
9, // 6: pb.public.SearchGames:input_type -> pb.SearchGamesReq
|
||||
2, // 7: pb.public.AddGames:output_type -> pb.AddGamesResp
|
||||
4, // 8: pb.public.UpdateGames:output_type -> pb.UpdateGamesResp
|
||||
6, // 9: pb.public.DelGames:output_type -> pb.DelGamesResp
|
||||
8, // 10: pb.public.GetGamesById:output_type -> pb.GetGamesByIdResp
|
||||
10, // 11: pb.public.SearchGames:output_type -> pb.SearchGamesResp
|
||||
7, // [7:12] is the sub-list for method output_type
|
||||
2, // [2:7] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_game_proto_init() }
|
||||
func file_game_proto_init() {
|
||||
if File_game_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_game_proto_rawDesc), len(file_game_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 11,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_game_proto_goTypes,
|
||||
DependencyIndexes: file_game_proto_depIdxs,
|
||||
MessageInfos: file_game_proto_msgTypes,
|
||||
}.Build()
|
||||
File_game_proto = out.File
|
||||
file_game_proto_goTypes = nil
|
||||
file_game_proto_depIdxs = nil
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc v5.29.6
|
||||
// source: game.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Public_AddGames_FullMethodName = "/pb.public/AddGames"
|
||||
Public_UpdateGames_FullMethodName = "/pb.public/UpdateGames"
|
||||
Public_DelGames_FullMethodName = "/pb.public/DelGames"
|
||||
Public_GetGamesById_FullMethodName = "/pb.public/GetGamesById"
|
||||
Public_SearchGames_FullMethodName = "/pb.public/SearchGames"
|
||||
)
|
||||
|
||||
// PublicClient is the client API for Public service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type PublicClient interface {
|
||||
// -----------------------games-----------------------
|
||||
AddGames(ctx context.Context, in *AddGamesReq, opts ...grpc.CallOption) (*AddGamesResp, error)
|
||||
UpdateGames(ctx context.Context, in *UpdateGamesReq, opts ...grpc.CallOption) (*UpdateGamesResp, error)
|
||||
DelGames(ctx context.Context, in *DelGamesReq, opts ...grpc.CallOption) (*DelGamesResp, error)
|
||||
GetGamesById(ctx context.Context, in *GetGamesByIdReq, opts ...grpc.CallOption) (*GetGamesByIdResp, error)
|
||||
SearchGames(ctx context.Context, in *SearchGamesReq, opts ...grpc.CallOption) (*SearchGamesResp, error)
|
||||
}
|
||||
|
||||
type publicClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewPublicClient(cc grpc.ClientConnInterface) PublicClient {
|
||||
return &publicClient{cc}
|
||||
}
|
||||
|
||||
func (c *publicClient) AddGames(ctx context.Context, in *AddGamesReq, opts ...grpc.CallOption) (*AddGamesResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(AddGamesResp)
|
||||
err := c.cc.Invoke(ctx, Public_AddGames_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *publicClient) UpdateGames(ctx context.Context, in *UpdateGamesReq, opts ...grpc.CallOption) (*UpdateGamesResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(UpdateGamesResp)
|
||||
err := c.cc.Invoke(ctx, Public_UpdateGames_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *publicClient) DelGames(ctx context.Context, in *DelGamesReq, opts ...grpc.CallOption) (*DelGamesResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DelGamesResp)
|
||||
err := c.cc.Invoke(ctx, Public_DelGames_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *publicClient) GetGamesById(ctx context.Context, in *GetGamesByIdReq, opts ...grpc.CallOption) (*GetGamesByIdResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetGamesByIdResp)
|
||||
err := c.cc.Invoke(ctx, Public_GetGamesById_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *publicClient) SearchGames(ctx context.Context, in *SearchGamesReq, opts ...grpc.CallOption) (*SearchGamesResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SearchGamesResp)
|
||||
err := c.cc.Invoke(ctx, Public_SearchGames_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// PublicServer is the server API for Public service.
|
||||
// All implementations must embed UnimplementedPublicServer
|
||||
// for forward compatibility.
|
||||
type PublicServer interface {
|
||||
// -----------------------games-----------------------
|
||||
AddGames(context.Context, *AddGamesReq) (*AddGamesResp, error)
|
||||
UpdateGames(context.Context, *UpdateGamesReq) (*UpdateGamesResp, error)
|
||||
DelGames(context.Context, *DelGamesReq) (*DelGamesResp, error)
|
||||
GetGamesById(context.Context, *GetGamesByIdReq) (*GetGamesByIdResp, error)
|
||||
SearchGames(context.Context, *SearchGamesReq) (*SearchGamesResp, error)
|
||||
mustEmbedUnimplementedPublicServer()
|
||||
}
|
||||
|
||||
// UnimplementedPublicServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedPublicServer struct{}
|
||||
|
||||
func (UnimplementedPublicServer) AddGames(context.Context, *AddGamesReq) (*AddGamesResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method AddGames not implemented")
|
||||
}
|
||||
func (UnimplementedPublicServer) UpdateGames(context.Context, *UpdateGamesReq) (*UpdateGamesResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method UpdateGames not implemented")
|
||||
}
|
||||
func (UnimplementedPublicServer) DelGames(context.Context, *DelGamesReq) (*DelGamesResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DelGames not implemented")
|
||||
}
|
||||
func (UnimplementedPublicServer) GetGamesById(context.Context, *GetGamesByIdReq) (*GetGamesByIdResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetGamesById not implemented")
|
||||
}
|
||||
func (UnimplementedPublicServer) SearchGames(context.Context, *SearchGamesReq) (*SearchGamesResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SearchGames not implemented")
|
||||
}
|
||||
func (UnimplementedPublicServer) mustEmbedUnimplementedPublicServer() {}
|
||||
func (UnimplementedPublicServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafePublicServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to PublicServer will
|
||||
// result in compilation errors.
|
||||
type UnsafePublicServer interface {
|
||||
mustEmbedUnimplementedPublicServer()
|
||||
}
|
||||
|
||||
func RegisterPublicServer(s grpc.ServiceRegistrar, srv PublicServer) {
|
||||
// If the following call panics, it indicates UnimplementedPublicServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&Public_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Public_AddGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AddGamesReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PublicServer).AddGames(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Public_AddGames_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PublicServer).AddGames(ctx, req.(*AddGamesReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Public_UpdateGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateGamesReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PublicServer).UpdateGames(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Public_UpdateGames_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PublicServer).UpdateGames(ctx, req.(*UpdateGamesReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Public_DelGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DelGamesReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PublicServer).DelGames(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Public_DelGames_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PublicServer).DelGames(ctx, req.(*DelGamesReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Public_GetGamesById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetGamesByIdReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PublicServer).GetGamesById(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Public_GetGamesById_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PublicServer).GetGamesById(ctx, req.(*GetGamesByIdReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Public_SearchGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SearchGamesReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PublicServer).SearchGames(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Public_SearchGames_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PublicServer).SearchGames(ctx, req.(*SearchGamesReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Public_ServiceDesc is the grpc.ServiceDesc for Public service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Public_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pb.public",
|
||||
HandlerType: (*PublicServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "AddGames",
|
||||
Handler: _Public_AddGames_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateGames",
|
||||
Handler: _Public_UpdateGames_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DelGames",
|
||||
Handler: _Public_DelGames_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetGamesById",
|
||||
Handler: _Public_GetGamesById_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SearchGames",
|
||||
Handler: _Public_SearchGames_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "game.proto",
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
// Source: game.proto
|
||||
|
||||
package public
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
AddGamesReq = pb.AddGamesReq
|
||||
AddGamesResp = pb.AddGamesResp
|
||||
DelGamesReq = pb.DelGamesReq
|
||||
DelGamesResp = pb.DelGamesResp
|
||||
Games = pb.Games
|
||||
GetGamesByIdReq = pb.GetGamesByIdReq
|
||||
GetGamesByIdResp = pb.GetGamesByIdResp
|
||||
SearchGamesReq = pb.SearchGamesReq
|
||||
SearchGamesResp = pb.SearchGamesResp
|
||||
UpdateGamesReq = pb.UpdateGamesReq
|
||||
UpdateGamesResp = pb.UpdateGamesResp
|
||||
|
||||
Public interface {
|
||||
// -----------------------games-----------------------
|
||||
AddGames(ctx context.Context, in *AddGamesReq, opts ...grpc.CallOption) (*AddGamesResp, error)
|
||||
UpdateGames(ctx context.Context, in *UpdateGamesReq, opts ...grpc.CallOption) (*UpdateGamesResp, error)
|
||||
DelGames(ctx context.Context, in *DelGamesReq, opts ...grpc.CallOption) (*DelGamesResp, error)
|
||||
GetGamesById(ctx context.Context, in *GetGamesByIdReq, opts ...grpc.CallOption) (*GetGamesByIdResp, error)
|
||||
SearchGames(ctx context.Context, in *SearchGamesReq, opts ...grpc.CallOption) (*SearchGamesResp, error)
|
||||
}
|
||||
|
||||
defaultPublic struct {
|
||||
cli zrpc.Client
|
||||
}
|
||||
)
|
||||
|
||||
func NewPublic(cli zrpc.Client) Public {
|
||||
return &defaultPublic{
|
||||
cli: cli,
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------games-----------------------
|
||||
func (m *defaultPublic) AddGames(ctx context.Context, in *AddGamesReq, opts ...grpc.CallOption) (*AddGamesResp, error) {
|
||||
client := pb.NewPublicClient(m.cli.Conn())
|
||||
return client.AddGames(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPublic) UpdateGames(ctx context.Context, in *UpdateGamesReq, opts ...grpc.CallOption) (*UpdateGamesResp, error) {
|
||||
client := pb.NewPublicClient(m.cli.Conn())
|
||||
return client.UpdateGames(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPublic) DelGames(ctx context.Context, in *DelGamesReq, opts ...grpc.CallOption) (*DelGamesResp, error) {
|
||||
client := pb.NewPublicClient(m.cli.Conn())
|
||||
return client.DelGames(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPublic) GetGamesById(ctx context.Context, in *GetGamesByIdReq, opts ...grpc.CallOption) (*GetGamesByIdResp, error) {
|
||||
client := pb.NewPublicClient(m.cli.Conn())
|
||||
return client.GetGamesById(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPublic) SearchGames(ctx context.Context, in *SearchGamesReq, opts ...grpc.CallOption) (*SearchGamesResp, error) {
|
||||
client := pb.NewPublicClient(m.cli.Conn())
|
||||
return client.SearchGames(ctx, in, opts...)
|
||||
}
|
||||
Reference in New Issue
Block a user