This commit is contained in:
oneao committed 2025-12-02 17:30:50 +08:00
1 parent 0ab2796dd4
commit f7b0c6ad2f
26 files changed
+1893 -354

No files matched your search

@@ -0,0 +1,95 @@
// Code generated by hertz generator.
package space
import (
"cn/oneao/base-go/biz/router/middleware"
"cn/oneao/base-go/db"
"cn/oneao/base-go/db/repo"
"cn/oneao/base-go/utils"
"cn/oneao/base-go/utils/errorx"
"cn/oneao/base-go/utils/idgen"
"cn/oneao/base-go/utils/response"
"context"
space "cn/oneao/base-go/biz/model/space"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
)
// InsertSpace .
// @router /space/insert [POST]
func InsertSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.InsertSpaceParams
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
userID := middleware.GetUserID(ctx)
// 检查该用户是否已经加入空间了
_, err = db.Queries.GetSpaceByUserId(ctx, userID)
if err != nil {
if errorx.IsNotFound(err) {
// 忽略
} else {
errorx.AddError(c, err)
return
}
} else {
response.Fail(c).Message("请先退出已加入的空间").Send()
return
}
// 生成邀请码
var inviteCode string
for {
// 生成邀请码
code, err := utils.GenerateCode(6)
if err != nil {
errorx.AddError(c, err)
return
}
// 检查数据库是否存在
_, err = db.Queries.GetSpaceByInviteCode(ctx, code)
if err != nil {
if errorx.IsNotFound(err) {
// 不存在,唯一,直接使用
inviteCode = code
break
} else {
// 系统错误
errorx.AddError(c, err)
return
}
}
// 如果存在,继续循环重新生成
}
// 创建空间
spaceId := idgen.NextId()
params := repo.InsertSpaceParams{
ID: spaceId,
InviteCode: inviteCode,
}
err = db.Queries.InsertSpace(ctx, params)
if err != nil {
errorx.AddError(c, err)
return
}
var resp space.InsertSpaceResult
resp.Id = spaceId
resp.InviteCode = inviteCode
response.Success(c).Data(resp).Send()
}
@@ -0,0 +1,78 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v4.25.3
// source: index.proto
package space
import (
_ "cn/oneao/base-go/biz/model/api"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
var File_index_proto protoreflect.FileDescriptor
var file_index_proto_rawDesc = []byte{
0x0a, 0x0b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73,
0x70, 0x61, 0x63, 0x65, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x17, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70,
0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x64, 0x0a, 0x0c, 0x53, 0x70, 0x61, 0x63,
0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x0b, 0x49, 0x6e, 0x73, 0x65,
0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e,
0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x73, 0x1a, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74,
0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x11, 0xd2, 0xc1, 0x18,
0x0d, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x42, 0x22,
0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d,
0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61,
0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_index_proto_goTypes = []interface{}{
(*InsertSpaceParams)(nil), // 0: space.InsertSpaceParams
(*InsertSpaceResult)(nil), // 1: space.InsertSpaceResult
}
var file_index_proto_depIdxs = []int32{
0, // 0: space.SpaceService.InsertSpace:input_type -> space.InsertSpaceParams
1, // 1: space.SpaceService.InsertSpace:output_type -> space.InsertSpaceResult
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_index_proto_init() }
func file_index_proto_init() {
if File_index_proto != nil {
return
}
file_space_space_types_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_index_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_index_proto_goTypes,
DependencyIndexes: file_index_proto_depIdxs,
}.Build()
File_index_proto = out.File
file_index_proto_rawDesc = nil
file_index_proto_goTypes = nil
file_index_proto_depIdxs = nil
}
@@ -0,0 +1,486 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v4.25.3
// source: space/space_types.proto
package space
import (
_ "cn/oneao/base-go/biz/model/api"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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)
)
// 创建空间
type InsertSpaceParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *InsertSpaceParams) Reset() {
*x = InsertSpaceParams{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *InsertSpaceParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InsertSpaceParams) ProtoMessage() {}
func (x *InsertSpaceParams) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use InsertSpaceParams.ProtoReflect.Descriptor instead.
func (*InsertSpaceParams) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{0}
}
type InsertSpaceResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id"`
InviteCode string `protobuf:"bytes,2,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"`
}
func (x *InsertSpaceResult) Reset() {
*x = InsertSpaceResult{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *InsertSpaceResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InsertSpaceResult) ProtoMessage() {}
func (x *InsertSpaceResult) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use InsertSpaceResult.ProtoReflect.Descriptor instead.
func (*InsertSpaceResult) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{1}
}
func (x *InsertSpaceResult) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *InsertSpaceResult) GetInviteCode() string {
if x != nil {
return x.InviteCode
}
return ""
}
// 解散空间
type DeleteSpaceParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DeleteSpaceParams) Reset() {
*x = DeleteSpaceParams{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteSpaceParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteSpaceParams) ProtoMessage() {}
func (x *DeleteSpaceParams) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteSpaceParams.ProtoReflect.Descriptor instead.
func (*DeleteSpaceParams) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{2}
}
type DeleteSpaceResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DeleteSpaceResult) Reset() {
*x = DeleteSpaceResult{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteSpaceResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteSpaceResult) ProtoMessage() {}
func (x *DeleteSpaceResult) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteSpaceResult.ProtoReflect.Descriptor instead.
func (*DeleteSpaceResult) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{3}
}
// 获取空间下的所有用户
type QuerySpaceUsersParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id" vd:"$ != 0"`
}
func (x *QuerySpaceUsersParams) Reset() {
*x = QuerySpaceUsersParams{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QuerySpaceUsersParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QuerySpaceUsersParams) ProtoMessage() {}
func (x *QuerySpaceUsersParams) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use QuerySpaceUsersParams.ProtoReflect.Descriptor instead.
func (*QuerySpaceUsersParams) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{4}
}
func (x *QuerySpaceUsersParams) GetSpaceId() int64 {
if x != nil {
return x.SpaceId
}
return 0
}
type SpaceUser struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *SpaceUser) Reset() {
*x = SpaceUser{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SpaceUser) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SpaceUser) ProtoMessage() {}
func (x *SpaceUser) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SpaceUser.ProtoReflect.Descriptor instead.
func (*SpaceUser) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{5}
}
type QuerySpaceUsersResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *QuerySpaceUsersResult) Reset() {
*x = QuerySpaceUsersResult{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QuerySpaceUsersResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QuerySpaceUsersResult) ProtoMessage() {}
func (x *QuerySpaceUsersResult) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use QuerySpaceUsersResult.ProtoReflect.Descriptor instead.
func (*QuerySpaceUsersResult) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{6}
}
var File_space_space_types_proto protoreflect.FileDescriptor
var file_space_space_types_proto_rawDesc = []byte{
0x0a, 0x17, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x79,
0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, 0x70, 0x61, 0x63, 0x65,
0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x49,
0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x22, 0x5c, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x42, 0x06, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2f, 0x0a,
0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f,
0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x13,
0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x73, 0x22, 0x13, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61,
0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x49, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72,
0x79, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x73, 0x12, 0x30, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x03, 0x42, 0x16, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64,
0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63,
0x65, 0x49, 0x64, 0x22, 0x0b, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72,
0x22, 0x17, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73,
0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f,
0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69,
0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_space_space_types_proto_rawDescOnce sync.Once
file_space_space_types_proto_rawDescData = file_space_space_types_proto_rawDesc
)
func file_space_space_types_proto_rawDescGZIP() []byte {
file_space_space_types_proto_rawDescOnce.Do(func() {
file_space_space_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_space_space_types_proto_rawDescData)
})
return file_space_space_types_proto_rawDescData
}
var file_space_space_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_space_space_types_proto_goTypes = []interface{}{
(*InsertSpaceParams)(nil), // 0: space.InsertSpaceParams
(*InsertSpaceResult)(nil), // 1: space.InsertSpaceResult
(*DeleteSpaceParams)(nil), // 2: space.DeleteSpaceParams
(*DeleteSpaceResult)(nil), // 3: space.DeleteSpaceResult
(*QuerySpaceUsersParams)(nil), // 4: space.QuerySpaceUsersParams
(*SpaceUser)(nil), // 5: space.SpaceUser
(*QuerySpaceUsersResult)(nil), // 6: space.QuerySpaceUsersResult
}
var file_space_space_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_space_space_types_proto_init() }
func file_space_space_types_proto_init() {
if File_space_space_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_space_space_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InsertSpaceParams); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_space_space_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InsertSpaceResult); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_space_space_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteSpaceParams); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_space_space_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteSpaceResult); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_space_space_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QuerySpaceUsersParams); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_space_space_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SpaceUser); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_space_space_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QuerySpaceUsersResult); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_space_space_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_space_space_types_proto_goTypes,
DependencyIndexes: file_space_space_types_proto_depIdxs,
MessageInfos: file_space_space_types_proto_msgTypes,
}.Build()
File_space_space_types_proto = out.File
file_space_space_types_proto_rawDesc = nil
file_space_space_types_proto_goTypes = nil
file_space_space_types_proto_depIdxs = nil
}
@@ -0,0 +1,224 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v4.25.3
// source: space/space_user_types.proto
package space
import (
_ "cn/oneao/base-go/biz/model/api"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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)
)
// 加入空间
type InsertSpaceUserParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
InviteCode int64 `protobuf:"varint,1,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` // 邀请码
}
func (x *InsertSpaceUserParams) Reset() {
*x = InsertSpaceUserParams{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_user_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *InsertSpaceUserParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InsertSpaceUserParams) ProtoMessage() {}
func (x *InsertSpaceUserParams) ProtoReflect() protoreflect.Message {
mi := &file_space_space_user_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use InsertSpaceUserParams.ProtoReflect.Descriptor instead.
func (*InsertSpaceUserParams) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{0}
}
func (x *InsertSpaceUserParams) GetInviteCode() int64 {
if x != nil {
return x.InviteCode
}
return 0
}
type InsertSpaceUserResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"`
InviteCode string `protobuf:"bytes,2,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"`
}
func (x *InsertSpaceUserResult) Reset() {
*x = InsertSpaceUserResult{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_user_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *InsertSpaceUserResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InsertSpaceUserResult) ProtoMessage() {}
func (x *InsertSpaceUserResult) ProtoReflect() protoreflect.Message {
mi := &file_space_space_user_types_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use InsertSpaceUserResult.ProtoReflect.Descriptor instead.
func (*InsertSpaceUserResult) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{1}
}
func (x *InsertSpaceUserResult) GetSpaceId() int64 {
if x != nil {
return x.SpaceId
}
return 0
}
func (x *InsertSpaceUserResult) GetInviteCode() string {
if x != nil {
return x.InviteCode
}
return ""
}
var File_space_space_user_types_proto protoreflect.FileDescriptor
var file_space_space_user_types_proto_rawDesc = []byte{
0x0a, 0x1c, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73,
0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05,
0x73, 0x70, 0x61, 0x63, 0x65, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0x48, 0x0a, 0x15, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55,
0x73, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76,
0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0f, 0xca,
0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a,
0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x70, 0x0a, 0x15, 0x49, 0x6e,
0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73,
0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f,
0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x0a, 0x49,
0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42,
0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65,
0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x22, 0x5a, 0x20,
0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f,
0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_space_space_user_types_proto_rawDescOnce sync.Once
file_space_space_user_types_proto_rawDescData = file_space_space_user_types_proto_rawDesc
)
func file_space_space_user_types_proto_rawDescGZIP() []byte {
file_space_space_user_types_proto_rawDescOnce.Do(func() {
file_space_space_user_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_space_space_user_types_proto_rawDescData)
})
return file_space_space_user_types_proto_rawDescData
}
var file_space_space_user_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_space_space_user_types_proto_goTypes = []interface{}{
(*InsertSpaceUserParams)(nil), // 0: space.InsertSpaceUserParams
(*InsertSpaceUserResult)(nil), // 1: space.InsertSpaceUserResult
}
var file_space_space_user_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_space_space_user_types_proto_init() }
func file_space_space_user_types_proto_init() {
if File_space_space_user_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_space_space_user_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InsertSpaceUserParams); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_space_space_user_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InsertSpaceUserResult); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_space_space_user_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_space_space_user_types_proto_goTypes,
DependencyIndexes: file_space_space_user_types_proto_depIdxs,
MessageInfos: file_space_space_user_types_proto_msgTypes,
}.Build()
File_space_space_user_types_proto = out.File
file_space_space_user_types_proto_rawDesc = nil
file_space_space_user_types_proto_goTypes = nil
file_space_space_user_types_proto_depIdxs = nil
}
@@ -5,12 +5,15 @@ package router
import (
auth "cn/oneao/base-go/biz/router/auth"
money "cn/oneao/base-go/biz/router/money"
space "cn/oneao/base-go/biz/router/space"
"github.com/cloudwego/hertz/pkg/app/server"
)
// GeneratedRegister registers routers generated by IDL.
func GeneratedRegister(r *server.Hertz) {
//INSERT_POINT: DO NOT DELETE THIS LINE!
space.Register(r)
auth.Register(r)
money.Register(r)
}
@@ -0,0 +1,24 @@
// Code generated by hertz generator. DO NOT EDIT.
package space
import (
space "cn/oneao/base-go/biz/handler/space"
"github.com/cloudwego/hertz/pkg/app/server"
)
/*
This file will register all the routes of the services in the master idl.
And it will update automatically when you use the "update" command for the idl.
So don't modify the contents of the file, or your code will be deleted when it is updated.
*/
// Register register routes based on the IDL 'api.${HTTP Method}' annotation.
func Register(r *server.Hertz) {
root := r.Group("/", rootMw()...)
{
_space := root.Group("/space", _spaceMw()...)
_space.POST("/insert", append(_insertspaceMw(), space.InsertSpace)...)
}
}
@@ -0,0 +1,22 @@
// Code generated by hertz generator.
package space
import (
"github.com/cloudwego/hertz/pkg/app"
)
func rootMw() []app.HandlerFunc {
// your code...
return nil
}
func _spaceMw() []app.HandlerFunc {
// your code...
return nil
}
func _insertspaceMw() []app.HandlerFunc {
// your code...
return nil
}