sklv1

package
v0.0.0-...-0e530db Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package sklv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	SklService_GetStaffUnitInfo_FullMethodName   = "/campusapis.skl.v1.SklService/GetStaffUnitInfo"
	SklService_GetStaffUnitDetail_FullMethodName = "/campusapis.skl.v1.SklService/GetStaffUnitDetail"
)

Variables

View Source
var File_campusapis_skl_v1_skl_proto protoreflect.FileDescriptor
View Source
var SklService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "campusapis.skl.v1.SklService",
	HandlerType: (*SklServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetStaffUnitInfo",
			Handler:    _SklService_GetStaffUnitInfo_Handler,
		},
		{
			MethodName: "GetStaffUnitDetail",
			Handler:    _SklService_GetStaffUnitDetail_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "campusapis/skl/v1/skl.proto",
}

SklService_ServiceDesc is the grpc.ServiceDesc for SklService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterSklServiceHandler

func RegisterSklServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterSklServiceHandler registers the http handlers for service SklService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterSklServiceHandlerClient

func RegisterSklServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SklServiceClient) error

RegisterSklServiceHandlerClient registers the http handlers for service SklService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SklServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SklServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SklServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterSklServiceHandlerFromEndpoint

func RegisterSklServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterSklServiceHandlerFromEndpoint is same as RegisterSklServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterSklServiceHandlerServer

func RegisterSklServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SklServiceServer) error

RegisterSklServiceHandlerServer registers the http handlers for service SklService to "mux". UnaryRPC :call SklServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSklServiceHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterSklServiceServer

func RegisterSklServiceServer(s grpc.ServiceRegistrar, srv SklServiceServer)

Types

type SklServiceClient

type SklServiceClient interface {
	// 获取某学院某年级的学生信息
	GetStaffUnitInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StaffUnitInfoResponse, error)
	GetStaffUnitDetail(ctx context.Context, in *StaffUnitDetailRequest, opts ...grpc.CallOption) (*StaffUnitDetailResponse, error)
}

SklServiceClient is the client API for SklService 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.

func NewSklServiceClient

func NewSklServiceClient(cc grpc.ClientConnInterface) SklServiceClient

type SklServiceServer

type SklServiceServer interface {
	// 获取某学院某年级的学生信息
	GetStaffUnitInfo(context.Context, *emptypb.Empty) (*StaffUnitInfoResponse, error)
	GetStaffUnitDetail(context.Context, *StaffUnitDetailRequest) (*StaffUnitDetailResponse, error)
	// contains filtered or unexported methods
}

SklServiceServer is the server API for SklService service. All implementations must embed UnimplementedSklServiceServer for forward compatibility.

type SklUnitDetail

type SklUnitDetail struct {
	StudentIDs []string `protobuf:"bytes,1,rep,name=studentIDs,proto3" json:"studentIDs,omitempty"` // 学号
	TeacherIDs []string `protobuf:"bytes,2,rep,name=teacherIDs,proto3" json:"teacherIDs,omitempty"` // 辅导员工号
	UnitId     string   `protobuf:"bytes,3,opt,name=unitId,proto3" json:"unitId,omitempty"`         // 学院ID
	UnitName   string   `protobuf:"bytes,4,opt,name=unitName,proto3" json:"unitName,omitempty"`     // 学院名称
	Grade      string   `protobuf:"bytes,5,opt,name=grade,proto3" json:"grade,omitempty"`           // 年级
	// contains filtered or unexported fields
}

用于从skl数据库中筛选某年级某学院的学生信息

func (*SklUnitDetail) Descriptor deprecated

func (*SklUnitDetail) Descriptor() ([]byte, []int)

Deprecated: Use SklUnitDetail.ProtoReflect.Descriptor instead.

func (*SklUnitDetail) GetGrade

func (x *SklUnitDetail) GetGrade() string

func (*SklUnitDetail) GetStudentIDs

func (x *SklUnitDetail) GetStudentIDs() []string

func (*SklUnitDetail) GetTeacherIDs

func (x *SklUnitDetail) GetTeacherIDs() []string

func (*SklUnitDetail) GetUnitId

func (x *SklUnitDetail) GetUnitId() string

func (*SklUnitDetail) GetUnitName

func (x *SklUnitDetail) GetUnitName() string

func (*SklUnitDetail) ProtoMessage

func (*SklUnitDetail) ProtoMessage()

func (*SklUnitDetail) ProtoReflect

func (x *SklUnitDetail) ProtoReflect() protoreflect.Message

func (*SklUnitDetail) Reset

func (x *SklUnitDetail) Reset()

func (*SklUnitDetail) String

func (x *SklUnitDetail) String() string

type SklUnitInfo

type SklUnitInfo struct {
	UnitId   string   `protobuf:"bytes,1,opt,name=unitId,proto3" json:"unitId,omitempty"`     // 学院ID
	UnitName string   `protobuf:"bytes,2,opt,name=unitName,proto3" json:"unitName,omitempty"` // 学院名称
	Grade    string   `protobuf:"bytes,3,opt,name=grade,proto3" json:"grade,omitempty"`       // 年级
	Teachers []string `protobuf:"bytes,4,rep,name=teachers,proto3" json:"teachers,omitempty"` // 辅导员
	ClassNos []string `protobuf:"bytes,5,rep,name=classNos,proto3" json:"classNos,omitempty"` // 班级列表
	// contains filtered or unexported fields
}

用于从Skl数据库中筛选某年级某学院的信息

func (*SklUnitInfo) Descriptor deprecated

func (*SklUnitInfo) Descriptor() ([]byte, []int)

Deprecated: Use SklUnitInfo.ProtoReflect.Descriptor instead.

func (*SklUnitInfo) GetClassNos

func (x *SklUnitInfo) GetClassNos() []string

func (*SklUnitInfo) GetGrade

func (x *SklUnitInfo) GetGrade() string

func (*SklUnitInfo) GetTeachers

func (x *SklUnitInfo) GetTeachers() []string

func (*SklUnitInfo) GetUnitId

func (x *SklUnitInfo) GetUnitId() string

func (*SklUnitInfo) GetUnitName

func (x *SklUnitInfo) GetUnitName() string

func (*SklUnitInfo) ProtoMessage

func (*SklUnitInfo) ProtoMessage()

func (*SklUnitInfo) ProtoReflect

func (x *SklUnitInfo) ProtoReflect() protoreflect.Message

func (*SklUnitInfo) Reset

func (x *SklUnitInfo) Reset()

func (*SklUnitInfo) String

func (x *SklUnitInfo) String() string

type StaffUnitDetailRequest

type StaffUnitDetailRequest struct {
	UnitId string `protobuf:"bytes,1,opt,name=unitId,proto3" json:"unitId,omitempty"` // 学院ID
	Grade  string `protobuf:"bytes,2,opt,name=grade,proto3" json:"grade,omitempty"`   // 年级
	// contains filtered or unexported fields
}

func (*StaffUnitDetailRequest) Descriptor deprecated

func (*StaffUnitDetailRequest) Descriptor() ([]byte, []int)

Deprecated: Use StaffUnitDetailRequest.ProtoReflect.Descriptor instead.

func (*StaffUnitDetailRequest) GetGrade

func (x *StaffUnitDetailRequest) GetGrade() string

func (*StaffUnitDetailRequest) GetUnitId

func (x *StaffUnitDetailRequest) GetUnitId() string

func (*StaffUnitDetailRequest) ProtoMessage

func (*StaffUnitDetailRequest) ProtoMessage()

func (*StaffUnitDetailRequest) ProtoReflect

func (x *StaffUnitDetailRequest) ProtoReflect() protoreflect.Message

func (*StaffUnitDetailRequest) Reset

func (x *StaffUnitDetailRequest) Reset()

func (*StaffUnitDetailRequest) String

func (x *StaffUnitDetailRequest) String() string

type StaffUnitDetailResponse

type StaffUnitDetailResponse struct {
	Error int32          `protobuf:"varint,1,opt,name=error,proto3" json:"error,omitempty"`
	Msg   string         `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	Data  *SklUnitDetail `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*StaffUnitDetailResponse) Descriptor deprecated

func (*StaffUnitDetailResponse) Descriptor() ([]byte, []int)

Deprecated: Use StaffUnitDetailResponse.ProtoReflect.Descriptor instead.

func (*StaffUnitDetailResponse) GetData

func (x *StaffUnitDetailResponse) GetData() *SklUnitDetail

func (*StaffUnitDetailResponse) GetError

func (x *StaffUnitDetailResponse) GetError() int32

func (*StaffUnitDetailResponse) GetMsg

func (x *StaffUnitDetailResponse) GetMsg() string

func (*StaffUnitDetailResponse) ProtoMessage

func (*StaffUnitDetailResponse) ProtoMessage()

func (*StaffUnitDetailResponse) ProtoReflect

func (x *StaffUnitDetailResponse) ProtoReflect() protoreflect.Message

func (*StaffUnitDetailResponse) Reset

func (x *StaffUnitDetailResponse) Reset()

func (*StaffUnitDetailResponse) String

func (x *StaffUnitDetailResponse) String() string

type StaffUnitInfoResponse

type StaffUnitInfoResponse struct {
	Error int32          `protobuf:"varint,1,opt,name=error,proto3" json:"error,omitempty"`
	Msg   string         `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	Data  []*SklUnitInfo `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*StaffUnitInfoResponse) Descriptor deprecated

func (*StaffUnitInfoResponse) Descriptor() ([]byte, []int)

Deprecated: Use StaffUnitInfoResponse.ProtoReflect.Descriptor instead.

func (*StaffUnitInfoResponse) GetData

func (x *StaffUnitInfoResponse) GetData() []*SklUnitInfo

func (*StaffUnitInfoResponse) GetError

func (x *StaffUnitInfoResponse) GetError() int32

func (*StaffUnitInfoResponse) GetMsg

func (x *StaffUnitInfoResponse) GetMsg() string

func (*StaffUnitInfoResponse) ProtoMessage

func (*StaffUnitInfoResponse) ProtoMessage()

func (*StaffUnitInfoResponse) ProtoReflect

func (x *StaffUnitInfoResponse) ProtoReflect() protoreflect.Message

func (*StaffUnitInfoResponse) Reset

func (x *StaffUnitInfoResponse) Reset()

func (*StaffUnitInfoResponse) String

func (x *StaffUnitInfoResponse) String() string

type UnimplementedSklServiceServer

type UnimplementedSklServiceServer struct{}

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

func (UnimplementedSklServiceServer) GetStaffUnitDetail

func (UnimplementedSklServiceServer) GetStaffUnitInfo

type UnsafeSklServiceServer

type UnsafeSklServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeSklServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SklServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL