api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogService_Log_FullMethodName      = "/lmoudle.LogService/Log"
	LogService_BatchLog_FullMethodName = "/lmoudle.LogService/BatchLog"
)
View Source
const (
	MessageService_SendMessage_FullMethodName      = "/lmoudle.MessageService/SendMessage"
	MessageService_BatchSendMessage_FullMethodName = "/lmoudle.MessageService/BatchSendMessage"
)

Variables

View Source
var (
	LogLevel_name = map[int32]string{
		0: "LOG_LEVEL_UNSPECIFIED",
		1: "LOG_LEVEL_DEBUG",
		2: "LOG_LEVEL_INFO",
		3: "LOG_LEVEL_WARN",
		4: "LOG_LEVEL_ERROR",
		5: "LOG_LEVEL_FATAL",
	}
	LogLevel_value = map[string]int32{
		"LOG_LEVEL_UNSPECIFIED": 0,
		"LOG_LEVEL_DEBUG":       1,
		"LOG_LEVEL_INFO":        2,
		"LOG_LEVEL_WARN":        3,
		"LOG_LEVEL_ERROR":       4,
		"LOG_LEVEL_FATAL":       5,
	}
)

Enum value maps for LogLevel.

View Source
var File_api_lmoudle_proto protoreflect.FileDescriptor
View Source
var LogService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "lmoudle.LogService",
	HandlerType: (*LogServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Log",
			Handler:    _LogService_Log_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "BatchLog",
			Handler:       _LogService_BatchLog_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "api/lmoudle.proto",
}

LogService_ServiceDesc is the grpc.ServiceDesc for LogService 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 MessageService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "lmoudle.MessageService",
	HandlerType: (*MessageServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SendMessage",
			Handler:    _MessageService_SendMessage_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "BatchSendMessage",
			Handler:       _MessageService_BatchSendMessage_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "api/lmoudle.proto",
}

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

Functions

func RegisterLogServiceServer

func RegisterLogServiceServer(s grpc.ServiceRegistrar, srv LogServiceServer)

func RegisterMessageServiceServer

func RegisterMessageServiceServer(s grpc.ServiceRegistrar, srv MessageServiceServer)

Types

type Fields

type Fields struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Fields) Descriptor deprecated

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

Deprecated: Use Fields.ProtoReflect.Descriptor instead.

func (*Fields) GetKey

func (x *Fields) GetKey() string

func (*Fields) GetValue

func (x *Fields) GetValue() string

func (*Fields) ProtoMessage

func (*Fields) ProtoMessage()

func (*Fields) ProtoReflect

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

func (*Fields) Reset

func (x *Fields) Reset()

func (*Fields) String

func (x *Fields) String() string

type LogLevel

type LogLevel int32

Log级别枚举

const (
	LogLevel_LOG_LEVEL_UNSPECIFIED LogLevel = 0
	LogLevel_LOG_LEVEL_DEBUG       LogLevel = 1
	LogLevel_LOG_LEVEL_INFO        LogLevel = 2
	LogLevel_LOG_LEVEL_WARN        LogLevel = 3
	LogLevel_LOG_LEVEL_ERROR       LogLevel = 4
	LogLevel_LOG_LEVEL_FATAL       LogLevel = 5
)

func (LogLevel) Descriptor

func (LogLevel) Descriptor() protoreflect.EnumDescriptor

func (LogLevel) Enum

func (x LogLevel) Enum() *LogLevel

func (LogLevel) EnumDescriptor deprecated

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

Deprecated: Use LogLevel.Descriptor instead.

func (LogLevel) Number

func (x LogLevel) Number() protoreflect.EnumNumber

func (LogLevel) String

func (x LogLevel) String() string

func (LogLevel) Type

type LogRequest

type LogRequest struct {
	Level     LogLevel  `protobuf:"varint,1,opt,name=level,proto3,enum=lmoudle.LogLevel" json:"level,omitempty"` // 日志级别
	Message   string    `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`                    // 日志消息
	Service   string    `protobuf:"bytes,3,opt,name=service,proto3" json:"service,omitempty"`                    // 服务名称
	Timestamp int64     `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`               // 时间戳
	Fields    []*Fields `protobuf:"bytes,5,rep,name=fields,proto3" json:"fields,omitempty"`                      // 结构化字段
	Tags      []string  `protobuf:"bytes,6,rep,name=tags,proto3" json:"tags,omitempty"`                          // 标签
	// contains filtered or unexported fields
}

Log请求消息

func (*LogRequest) Descriptor deprecated

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

Deprecated: Use LogRequest.ProtoReflect.Descriptor instead.

func (*LogRequest) GetFields

func (x *LogRequest) GetFields() []*Fields

func (*LogRequest) GetLevel

func (x *LogRequest) GetLevel() LogLevel

func (*LogRequest) GetMessage

func (x *LogRequest) GetMessage() string

func (*LogRequest) GetService

func (x *LogRequest) GetService() string

func (*LogRequest) GetTags

func (x *LogRequest) GetTags() []string

func (*LogRequest) GetTimestamp

func (x *LogRequest) GetTimestamp() int64

func (*LogRequest) ProtoMessage

func (*LogRequest) ProtoMessage()

func (*LogRequest) ProtoReflect

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

func (*LogRequest) Reset

func (x *LogRequest) Reset()

func (*LogRequest) String

func (x *LogRequest) String() string

type LogServiceClient

type LogServiceClient interface {
	// 记录日志
	Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*Response, error)
	// 批量记录日志
	BatchLog(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[LogRequest, Response], error)
}

LogServiceClient is the client API for LogService 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.

Log服务定义

func NewLogServiceClient

func NewLogServiceClient(cc grpc.ClientConnInterface) LogServiceClient

type LogServiceServer

type LogServiceServer interface {
	// 记录日志
	Log(context.Context, *LogRequest) (*Response, error)
	// 批量记录日志
	BatchLog(grpc.ClientStreamingServer[LogRequest, Response]) error
	// contains filtered or unexported methods
}

LogServiceServer is the server API for LogService service. All implementations must embed UnimplementedLogServiceServer for forward compatibility.

Log服务定义

type LogService_BatchLogClient

type LogService_BatchLogClient = grpc.ClientStreamingClient[LogRequest, Response]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type LogService_BatchLogServer

type LogService_BatchLogServer = grpc.ClientStreamingServer[LogRequest, Response]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type MessageRequest

type MessageRequest struct {
	Content   string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`      // 消息内容
	Sender    string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"`        // 发送者
	Receiver  string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"`    // 接收者
	Timestamp int64  `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 时间戳
	// contains filtered or unexported fields
}

Message请求消息

func (*MessageRequest) Descriptor deprecated

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

Deprecated: Use MessageRequest.ProtoReflect.Descriptor instead.

func (*MessageRequest) GetContent

func (x *MessageRequest) GetContent() string

func (*MessageRequest) GetReceiver

func (x *MessageRequest) GetReceiver() string

func (*MessageRequest) GetSender

func (x *MessageRequest) GetSender() string

func (*MessageRequest) GetTimestamp

func (x *MessageRequest) GetTimestamp() int64

func (*MessageRequest) ProtoMessage

func (*MessageRequest) ProtoMessage()

func (*MessageRequest) ProtoReflect

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

func (*MessageRequest) Reset

func (x *MessageRequest) Reset()

func (*MessageRequest) String

func (x *MessageRequest) String() string

type MessageServiceClient

type MessageServiceClient interface {
	// 发送消息
	SendMessage(ctx context.Context, in *MessageRequest, opts ...grpc.CallOption) (*Response, error)
	// 批量发送消息
	BatchSendMessage(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[MessageRequest, Response], error)
}

MessageServiceClient is the client API for MessageService 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.

Message服务定义

type MessageServiceServer

type MessageServiceServer interface {
	// 发送消息
	SendMessage(context.Context, *MessageRequest) (*Response, error)
	// 批量发送消息
	BatchSendMessage(grpc.ClientStreamingServer[MessageRequest, Response]) error
	// contains filtered or unexported methods
}

MessageServiceServer is the server API for MessageService service. All implementations must embed UnimplementedMessageServiceServer for forward compatibility.

Message服务定义

type MessageService_BatchSendMessageClient

type MessageService_BatchSendMessageClient = grpc.ClientStreamingClient[MessageRequest, Response]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type MessageService_BatchSendMessageServer

type MessageService_BatchSendMessageServer = grpc.ClientStreamingServer[MessageRequest, Response]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Response

type Response struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // 是否成功
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`  // 响应消息
	Code    int32  `protobuf:"varint,3,opt,name=code,proto3" json:"code,omitempty"`       // 响应码
	// contains filtered or unexported fields
}

通用响应消息

func (*Response) Descriptor deprecated

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetCode

func (x *Response) GetCode() int32

func (*Response) GetMessage

func (x *Response) GetMessage() string

func (*Response) GetSuccess

func (x *Response) GetSuccess() bool

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type UnimplementedLogServiceServer

type UnimplementedLogServiceServer struct{}

UnimplementedLogServiceServer 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 (UnimplementedLogServiceServer) BatchLog

func (UnimplementedLogServiceServer) Log

type UnimplementedMessageServiceServer

type UnimplementedMessageServiceServer struct{}

UnimplementedMessageServiceServer 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 (UnimplementedMessageServiceServer) BatchSendMessage

func (UnimplementedMessageServiceServer) SendMessage

type UnsafeLogServiceServer

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

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

type UnsafeMessageServiceServer

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

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

Jump to

Keyboard shortcuts

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