v1

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClassService_SearchClass_FullMethodName = "/classService.v1.ClassService/SearchClass"
	ClassService_AddClass_FullMethodName    = "/classService.v1.ClassService/AddClass"
)
View Source
const OperationClassServiceAddClass = "/classService.v1.ClassService/AddClass"
View Source
const OperationClassServiceSearchClass = "/classService.v1.ClassService/SearchClass"

Variables

View Source
var (
	ErrorReason_name = map[int32]string{
		0: "ES_AddClassFailed",
		1: "ES_SearchClassFailed",
	}
	ErrorReason_value = map[string]int32{
		"ES_AddClassFailed":    0,
		"ES_SearchClassFailed": 1,
	}
)

Enum value maps for ErrorReason.

View Source
var ClassService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "classService.v1.ClassService",
	HandlerType: (*ClassServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SearchClass",
			Handler:    _ClassService_SearchClass_Handler,
		},
		{
			MethodName: "AddClass",
			Handler:    _ClassService_AddClass_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "classService/v1/classService.proto",
}

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

View Source
var File_classService_v1_classService_proto protoreflect.FileDescriptor
View Source
var File_classService_v1_error_reason_proto protoreflect.FileDescriptor

Functions

func ErrorEsAddClassFailed

func ErrorEsAddClassFailed(format string, args ...interface{}) *errors.Error

func ErrorEsSearchClassFailed

func ErrorEsSearchClassFailed(format string, args ...interface{}) *errors.Error

func IsEsAddClassFailed

func IsEsAddClassFailed(err error) bool

func IsEsSearchClassFailed

func IsEsSearchClassFailed(err error) bool

func RegisterClassServiceHTTPServer

func RegisterClassServiceHTTPServer(s *http.Server, srv ClassServiceHTTPServer)

func RegisterClassServiceServer

func RegisterClassServiceServer(s grpc.ServiceRegistrar, srv ClassServiceServer)

Types

type AddClassReply

type AddClassReply struct {

	// 添加的课程ID
	Id  string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	// contains filtered or unexported fields
}

func (*AddClassReply) Descriptor deprecated

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

Deprecated: Use AddClassReply.ProtoReflect.Descriptor instead.

func (*AddClassReply) GetId

func (x *AddClassReply) GetId() string

func (*AddClassReply) GetMsg

func (x *AddClassReply) GetMsg() string

func (*AddClassReply) ProtoMessage

func (*AddClassReply) ProtoMessage()

func (*AddClassReply) ProtoReflect

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

func (*AddClassReply) Reset

func (x *AddClassReply) Reset()

func (*AddClassReply) String

func (x *AddClassReply) String() string

func (*AddClassReply) Validate

func (m *AddClassReply) Validate() error

Validate checks the field values on AddClassReply with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*AddClassReply) ValidateAll

func (m *AddClassReply) ValidateAll() error

ValidateAll checks the field values on AddClassReply with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in AddClassReplyMultiError, or nil if none found.

type AddClassReplyMultiError

type AddClassReplyMultiError []error

AddClassReplyMultiError is an error wrapping multiple validation errors returned by AddClassReply.ValidateAll() if the designated constraints aren't met.

func (AddClassReplyMultiError) AllErrors

func (m AddClassReplyMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (AddClassReplyMultiError) Error

func (m AddClassReplyMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type AddClassReplyValidationError

type AddClassReplyValidationError struct {
	// contains filtered or unexported fields
}

AddClassReplyValidationError is the validation error returned by AddClassReply.Validate if the designated constraints aren't met.

func (AddClassReplyValidationError) Cause

Cause function returns cause value.

func (AddClassReplyValidationError) Error

Error satisfies the builtin error interface

func (AddClassReplyValidationError) ErrorName

func (e AddClassReplyValidationError) ErrorName() string

ErrorName returns error name.

func (AddClassReplyValidationError) Field

Field function returns field value.

func (AddClassReplyValidationError) Key

Key function returns key value.

func (AddClassReplyValidationError) Reason

Reason function returns reason value.

type AddClassRequest

type AddClassRequest struct {

	// 学号
	StuId string `protobuf:"bytes,1,opt,name=stu_id,proto3" json:"stu_id,omitempty"`
	// 课程名称
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// 第几节 '形如 "1-3","1-1"'
	DurClass string `protobuf:"bytes,3,opt,name=dur_class,proto3" json:"dur_class,omitempty"`
	// 地点
	Where string `protobuf:"bytes,4,opt,name=where,proto3" json:"where,omitempty"`
	// 教师
	Teacher string `protobuf:"bytes,5,opt,name=teacher,proto3" json:"teacher,omitempty"`
	// 哪些周
	Weeks int64 `protobuf:"varint,6,opt,name=weeks,proto3" json:"weeks,omitempty"`
	// 学期
	Semester string `protobuf:"bytes,7,opt,name=semester,proto3" json:"semester,omitempty"`
	// 学年
	Year string `protobuf:"bytes,8,opt,name=year,proto3" json:"year,omitempty"`
	// 星期几
	Day int64 `protobuf:"varint,9,opt,name=day,proto3" json:"day,omitempty"`
	// 学分
	Credit *float64 `protobuf:"fixed64,10,opt,name=credit,proto3,oneof" json:"credit,omitempty"`
	// contains filtered or unexported fields
}

func (*AddClassRequest) Descriptor deprecated

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

Deprecated: Use AddClassRequest.ProtoReflect.Descriptor instead.

func (*AddClassRequest) GetCredit

func (x *AddClassRequest) GetCredit() float64

func (*AddClassRequest) GetDay

func (x *AddClassRequest) GetDay() int64

func (*AddClassRequest) GetDurClass

func (x *AddClassRequest) GetDurClass() string

func (*AddClassRequest) GetName

func (x *AddClassRequest) GetName() string

func (*AddClassRequest) GetSemester

func (x *AddClassRequest) GetSemester() string

func (*AddClassRequest) GetStuId

func (x *AddClassRequest) GetStuId() string

func (*AddClassRequest) GetTeacher

func (x *AddClassRequest) GetTeacher() string

func (*AddClassRequest) GetWeeks

func (x *AddClassRequest) GetWeeks() int64

func (*AddClassRequest) GetWhere

func (x *AddClassRequest) GetWhere() string

func (*AddClassRequest) GetYear

func (x *AddClassRequest) GetYear() string

func (*AddClassRequest) ProtoMessage

func (*AddClassRequest) ProtoMessage()

func (*AddClassRequest) ProtoReflect

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

func (*AddClassRequest) Reset

func (x *AddClassRequest) Reset()

func (*AddClassRequest) String

func (x *AddClassRequest) String() string

func (*AddClassRequest) Validate

func (m *AddClassRequest) Validate() error

Validate checks the field values on AddClassRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*AddClassRequest) ValidateAll

func (m *AddClassRequest) ValidateAll() error

ValidateAll checks the field values on AddClassRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in AddClassRequestMultiError, or nil if none found.

type AddClassRequestMultiError

type AddClassRequestMultiError []error

AddClassRequestMultiError is an error wrapping multiple validation errors returned by AddClassRequest.ValidateAll() if the designated constraints aren't met.

func (AddClassRequestMultiError) AllErrors

func (m AddClassRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (AddClassRequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type AddClassRequestValidationError

type AddClassRequestValidationError struct {
	// contains filtered or unexported fields
}

AddClassRequestValidationError is the validation error returned by AddClassRequest.Validate if the designated constraints aren't met.

func (AddClassRequestValidationError) Cause

Cause function returns cause value.

func (AddClassRequestValidationError) Error

Error satisfies the builtin error interface

func (AddClassRequestValidationError) ErrorName

func (e AddClassRequestValidationError) ErrorName() string

ErrorName returns error name.

func (AddClassRequestValidationError) Field

Field function returns field value.

func (AddClassRequestValidationError) Key

Key function returns key value.

func (AddClassRequestValidationError) Reason

Reason function returns reason value.

type ClassInfo

type ClassInfo struct {

	// 星期几
	Day int64 `protobuf:"varint,1,opt,name=day,proto3" json:"day,omitempty"`
	// 任课教师
	Teacher string `protobuf:"bytes,2,opt,name=teacher,proto3" json:"teacher,omitempty"`
	// 上课地点
	Where string `protobuf:"bytes,3,opt,name=where,proto3" json:"where,omitempty"`
	// 上课是第几节(如1-2,3,4)
	ClassWhen string `protobuf:"bytes,4,opt,name=class_when,proto3" json:"class_when,omitempty"`
	// 上课的周数(文字描述,如1-9周)
	WeekDuration string `protobuf:"bytes,5,opt,name=week_duration,proto3" json:"week_duration,omitempty"`
	// 课程名称
	Classname string `protobuf:"bytes,6,opt,name=classname,proto3" json:"classname,omitempty"`
	// 学分
	Credit float64 `protobuf:"fixed64,7,opt,name=credit,proto3" json:"credit,omitempty"`
	// 哪些周 这个是一个64位的数字,如果有第一周,那么该数的二进制从右往左的第一位为1,以此类推
	// 比如该数的二进制是000000101,就代表第一周和第三周有课.
	Weeks int64 `protobuf:"varint,9,opt,name=weeks,proto3" json:"weeks,omitempty"`
	// 学期 "1"代表第一学期,"2"代表第二学期,"3"代表第三学期
	Semester string `protobuf:"bytes,10,opt,name=semester,proto3" json:"semester,omitempty"`
	// 学年  "2024" 代表"2024-2025学年"
	Year string `protobuf:"bytes,11,opt,name=year,proto3" json:"year,omitempty"`
	// 课程唯一标识id
	Id string `protobuf:"bytes,12,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*ClassInfo) Descriptor deprecated

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

Deprecated: Use ClassInfo.ProtoReflect.Descriptor instead.

func (*ClassInfo) GetClassWhen

func (x *ClassInfo) GetClassWhen() string

func (*ClassInfo) GetClassname

func (x *ClassInfo) GetClassname() string

func (*ClassInfo) GetCredit

func (x *ClassInfo) GetCredit() float64

func (*ClassInfo) GetDay

func (x *ClassInfo) GetDay() int64

func (*ClassInfo) GetId

func (x *ClassInfo) GetId() string

func (*ClassInfo) GetSemester

func (x *ClassInfo) GetSemester() string

func (*ClassInfo) GetTeacher

func (x *ClassInfo) GetTeacher() string

func (*ClassInfo) GetWeekDuration

func (x *ClassInfo) GetWeekDuration() string

func (*ClassInfo) GetWeeks

func (x *ClassInfo) GetWeeks() int64

func (*ClassInfo) GetWhere

func (x *ClassInfo) GetWhere() string

func (*ClassInfo) GetYear

func (x *ClassInfo) GetYear() string

func (*ClassInfo) ProtoMessage

func (*ClassInfo) ProtoMessage()

func (*ClassInfo) ProtoReflect

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

func (*ClassInfo) Reset

func (x *ClassInfo) Reset()

func (*ClassInfo) String

func (x *ClassInfo) String() string

func (*ClassInfo) Validate

func (m *ClassInfo) Validate() error

Validate checks the field values on ClassInfo with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*ClassInfo) ValidateAll

func (m *ClassInfo) ValidateAll() error

ValidateAll checks the field values on ClassInfo with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ClassInfoMultiError, or nil if none found.

type ClassInfoMultiError

type ClassInfoMultiError []error

ClassInfoMultiError is an error wrapping multiple validation errors returned by ClassInfo.ValidateAll() if the designated constraints aren't met.

func (ClassInfoMultiError) AllErrors

func (m ClassInfoMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ClassInfoMultiError) Error

func (m ClassInfoMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ClassInfoValidationError

type ClassInfoValidationError struct {
	// contains filtered or unexported fields
}

ClassInfoValidationError is the validation error returned by ClassInfo.Validate if the designated constraints aren't met.

func (ClassInfoValidationError) Cause

func (e ClassInfoValidationError) Cause() error

Cause function returns cause value.

func (ClassInfoValidationError) Error

func (e ClassInfoValidationError) Error() string

Error satisfies the builtin error interface

func (ClassInfoValidationError) ErrorName

func (e ClassInfoValidationError) ErrorName() string

ErrorName returns error name.

func (ClassInfoValidationError) Field

func (e ClassInfoValidationError) Field() string

Field function returns field value.

func (ClassInfoValidationError) Key

Key function returns key value.

func (ClassInfoValidationError) Reason

func (e ClassInfoValidationError) Reason() string

Reason function returns reason value.

type ClassServiceClient

type ClassServiceClient interface {
	// 数据源是所有使用匣子的用户的课表,从其中搜索相应的课程
	SearchClass(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchReply, error)
	// 添加课程
	AddClass(ctx context.Context, in *AddClassRequest, opts ...grpc.CallOption) (*AddClassReply, error)
}

ClassServiceClient is the client API for ClassService 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.

The greeting service definition.

type ClassServiceHTTPClient

type ClassServiceHTTPClient interface {
	AddClass(ctx context.Context, req *AddClassRequest, opts ...http.CallOption) (rsp *AddClassReply, err error)
	SearchClass(ctx context.Context, req *SearchRequest, opts ...http.CallOption) (rsp *SearchReply, err error)
}

func NewClassServiceHTTPClient

func NewClassServiceHTTPClient(client *http.Client) ClassServiceHTTPClient

type ClassServiceHTTPClientImpl

type ClassServiceHTTPClientImpl struct {
	// contains filtered or unexported fields
}

func (*ClassServiceHTTPClientImpl) AddClass

func (*ClassServiceHTTPClientImpl) SearchClass

type ClassServiceHTTPServer

type ClassServiceHTTPServer interface {
	// AddClass添加课程
	AddClass(context.Context, *AddClassRequest) (*AddClassReply, error)
	// SearchClass 数据源是所有使用匣子的用户的课表,从其中搜索相应的课程
	SearchClass(context.Context, *SearchRequest) (*SearchReply, error)
}

type ClassServiceServer

type ClassServiceServer interface {
	// 数据源是所有使用匣子的用户的课表,从其中搜索相应的课程
	SearchClass(context.Context, *SearchRequest) (*SearchReply, error)
	// 添加课程
	AddClass(context.Context, *AddClassRequest) (*AddClassReply, error)
	// contains filtered or unexported methods
}

ClassServiceServer is the server API for ClassService service. All implementations must embed UnimplementedClassServiceServer for forward compatibility.

The greeting service definition.

type ErrorReason

type ErrorReason int32
const (
	ErrorReason_ES_AddClassFailed    ErrorReason = 0
	ErrorReason_ES_SearchClassFailed ErrorReason = 1
)

func (ErrorReason) Descriptor

func (ErrorReason) Enum

func (x ErrorReason) Enum() *ErrorReason

func (ErrorReason) EnumDescriptor deprecated

func (ErrorReason) EnumDescriptor() ([]byte, []int)

Deprecated: Use ErrorReason.Descriptor instead.

func (ErrorReason) Number

func (x ErrorReason) Number() protoreflect.EnumNumber

func (ErrorReason) String

func (x ErrorReason) String() string

func (ErrorReason) Type

type SearchReply

type SearchReply struct {

	// 课程信息
	ClassInfos []*ClassInfo `protobuf:"bytes,1,rep,name=class_infos,proto3" json:"class_infos,omitempty"`
	// contains filtered or unexported fields
}

func (*SearchReply) Descriptor deprecated

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

Deprecated: Use SearchReply.ProtoReflect.Descriptor instead.

func (*SearchReply) GetClassInfos

func (x *SearchReply) GetClassInfos() []*ClassInfo

func (*SearchReply) ProtoMessage

func (*SearchReply) ProtoMessage()

func (*SearchReply) ProtoReflect

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

func (*SearchReply) Reset

func (x *SearchReply) Reset()

func (*SearchReply) String

func (x *SearchReply) String() string

func (*SearchReply) Validate

func (m *SearchReply) Validate() error

Validate checks the field values on SearchReply with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*SearchReply) ValidateAll

func (m *SearchReply) ValidateAll() error

ValidateAll checks the field values on SearchReply with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in SearchReplyMultiError, or nil if none found.

type SearchReplyMultiError

type SearchReplyMultiError []error

SearchReplyMultiError is an error wrapping multiple validation errors returned by SearchReply.ValidateAll() if the designated constraints aren't met.

func (SearchReplyMultiError) AllErrors

func (m SearchReplyMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SearchReplyMultiError) Error

func (m SearchReplyMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type SearchReplyValidationError

type SearchReplyValidationError struct {
	// contains filtered or unexported fields
}

SearchReplyValidationError is the validation error returned by SearchReply.Validate if the designated constraints aren't met.

func (SearchReplyValidationError) Cause

Cause function returns cause value.

func (SearchReplyValidationError) Error

Error satisfies the builtin error interface

func (SearchReplyValidationError) ErrorName

func (e SearchReplyValidationError) ErrorName() string

ErrorName returns error name.

func (SearchReplyValidationError) Field

Field function returns field value.

func (SearchReplyValidationError) Key

Key function returns key value.

func (SearchReplyValidationError) Reason

Reason function returns reason value.

type SearchRequest

type SearchRequest struct {

	// 搜索关键词,匹配的是课程名称和教师姓名
	SearchKeyWords string `protobuf:"bytes,1,opt,name=searchKeyWords,proto3" json:"searchKeyWords,omitempty"`
	Year           string `protobuf:"bytes,2,opt,name=year,proto3" json:"year,omitempty"`
	Semester       string `protobuf:"bytes,3,opt,name=semester,proto3" json:"semester,omitempty"`
	// contains filtered or unexported fields
}

func (*SearchRequest) Descriptor deprecated

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

Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.

func (*SearchRequest) GetSearchKeyWords

func (x *SearchRequest) GetSearchKeyWords() string

func (*SearchRequest) GetSemester

func (x *SearchRequest) GetSemester() string

func (*SearchRequest) GetYear

func (x *SearchRequest) GetYear() string

func (*SearchRequest) ProtoMessage

func (*SearchRequest) ProtoMessage()

func (*SearchRequest) ProtoReflect

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

func (*SearchRequest) Reset

func (x *SearchRequest) Reset()

func (*SearchRequest) String

func (x *SearchRequest) String() string

func (*SearchRequest) Validate

func (m *SearchRequest) Validate() error

Validate checks the field values on SearchRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*SearchRequest) ValidateAll

func (m *SearchRequest) ValidateAll() error

ValidateAll checks the field values on SearchRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in SearchRequestMultiError, or nil if none found.

type SearchRequestMultiError

type SearchRequestMultiError []error

SearchRequestMultiError is an error wrapping multiple validation errors returned by SearchRequest.ValidateAll() if the designated constraints aren't met.

func (SearchRequestMultiError) AllErrors

func (m SearchRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SearchRequestMultiError) Error

func (m SearchRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type SearchRequestValidationError

type SearchRequestValidationError struct {
	// contains filtered or unexported fields
}

SearchRequestValidationError is the validation error returned by SearchRequest.Validate if the designated constraints aren't met.

func (SearchRequestValidationError) Cause

Cause function returns cause value.

func (SearchRequestValidationError) Error

Error satisfies the builtin error interface

func (SearchRequestValidationError) ErrorName

func (e SearchRequestValidationError) ErrorName() string

ErrorName returns error name.

func (SearchRequestValidationError) Field

Field function returns field value.

func (SearchRequestValidationError) Key

Key function returns key value.

func (SearchRequestValidationError) Reason

Reason function returns reason value.

type UnimplementedClassServiceServer

type UnimplementedClassServiceServer struct{}

UnimplementedClassServiceServer 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 (UnimplementedClassServiceServer) AddClass

func (UnimplementedClassServiceServer) SearchClass

type UnsafeClassServiceServer

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

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

Jump to

Keyboard shortcuts

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