Initial accounting

This commit is contained in:
root 2023-07-24 13:18:11 +05:00
parent b04e5ad686
commit 355642572c
3 changed files with 1006 additions and 0 deletions

727
accounting/accounting.pb.go Normal file
View file

@ -0,0 +1,727 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc v3.6.1
// source: accounting.proto
package accounting
import (
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 AllowRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
IsGroup bool `protobuf:"varint,2,opt,name=is_group,json=isGroup,proto3" json:"is_group,omitempty"`
Rule string `protobuf:"bytes,3,opt,name=rule,proto3" json:"rule,omitempty"`
}
func (x *AllowRequest) Reset() {
*x = AllowRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_accounting_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AllowRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AllowRequest) ProtoMessage() {}
func (x *AllowRequest) ProtoReflect() protoreflect.Message {
mi := &file_accounting_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 AllowRequest.ProtoReflect.Descriptor instead.
func (*AllowRequest) Descriptor() ([]byte, []int) {
return file_accounting_proto_rawDescGZIP(), []int{0}
}
func (x *AllowRequest) GetId() uint32 {
if x != nil {
return x.Id
}
return 0
}
func (x *AllowRequest) GetIsGroup() bool {
if x != nil {
return x.IsGroup
}
return false
}
func (x *AllowRequest) GetRule() string {
if x != nil {
return x.Rule
}
return ""
}
type AllowReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Access bool `protobuf:"varint,1,opt,name=access,proto3" json:"access,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
}
func (x *AllowReply) Reset() {
*x = AllowReply{}
if protoimpl.UnsafeEnabled {
mi := &file_accounting_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AllowReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AllowReply) ProtoMessage() {}
func (x *AllowReply) ProtoReflect() protoreflect.Message {
mi := &file_accounting_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 AllowReply.ProtoReflect.Descriptor instead.
func (*AllowReply) Descriptor() ([]byte, []int) {
return file_accounting_proto_rawDescGZIP(), []int{1}
}
func (x *AllowReply) GetAccess() bool {
if x != nil {
return x.Access
}
return false
}
func (x *AllowReply) GetError() string {
if x != nil {
return x.Error
}
return ""
}
type SetRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
IsGroup bool `protobuf:"varint,2,opt,name=is_group,json=isGroup,proto3" json:"is_group,omitempty"`
Rule string `protobuf:"bytes,3,opt,name=rule,proto3" json:"rule,omitempty"`
Val int32 `protobuf:"varint,4,opt,name=val,proto3" json:"val,omitempty"`
}
func (x *SetRequest) Reset() {
*x = SetRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_accounting_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SetRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SetRequest) ProtoMessage() {}
func (x *SetRequest) ProtoReflect() protoreflect.Message {
mi := &file_accounting_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 SetRequest.ProtoReflect.Descriptor instead.
func (*SetRequest) Descriptor() ([]byte, []int) {
return file_accounting_proto_rawDescGZIP(), []int{2}
}
func (x *SetRequest) GetId() uint32 {
if x != nil {
return x.Id
}
return 0
}
func (x *SetRequest) GetIsGroup() bool {
if x != nil {
return x.IsGroup
}
return false
}
func (x *SetRequest) GetRule() string {
if x != nil {
return x.Rule
}
return ""
}
func (x *SetRequest) GetVal() int32 {
if x != nil {
return x.Val
}
return 0
}
type SetReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
}
func (x *SetReply) Reset() {
*x = SetReply{}
if protoimpl.UnsafeEnabled {
mi := &file_accounting_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SetReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SetReply) ProtoMessage() {}
func (x *SetReply) ProtoReflect() protoreflect.Message {
mi := &file_accounting_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 SetReply.ProtoReflect.Descriptor instead.
func (*SetReply) Descriptor() ([]byte, []int) {
return file_accounting_proto_rawDescGZIP(), []int{3}
}
func (x *SetReply) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *SetReply) GetError() string {
if x != nil {
return x.Error
}
return ""
}
type AddGroupRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
IsGroup bool `protobuf:"varint,2,opt,name=is_group,json=isGroup,proto3" json:"is_group,omitempty"`
GroupId uint32 `protobuf:"varint,3,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
}
func (x *AddGroupRequest) Reset() {
*x = AddGroupRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_accounting_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddGroupRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddGroupRequest) ProtoMessage() {}
func (x *AddGroupRequest) ProtoReflect() protoreflect.Message {
mi := &file_accounting_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 AddGroupRequest.ProtoReflect.Descriptor instead.
func (*AddGroupRequest) Descriptor() ([]byte, []int) {
return file_accounting_proto_rawDescGZIP(), []int{4}
}
func (x *AddGroupRequest) GetId() uint32 {
if x != nil {
return x.Id
}
return 0
}
func (x *AddGroupRequest) GetIsGroup() bool {
if x != nil {
return x.IsGroup
}
return false
}
func (x *AddGroupRequest) GetGroupId() uint32 {
if x != nil {
return x.GroupId
}
return 0
}
type AddGroupReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
}
func (x *AddGroupReply) Reset() {
*x = AddGroupReply{}
if protoimpl.UnsafeEnabled {
mi := &file_accounting_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddGroupReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddGroupReply) ProtoMessage() {}
func (x *AddGroupReply) ProtoReflect() protoreflect.Message {
mi := &file_accounting_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 AddGroupReply.ProtoReflect.Descriptor instead.
func (*AddGroupReply) Descriptor() ([]byte, []int) {
return file_accounting_proto_rawDescGZIP(), []int{5}
}
func (x *AddGroupReply) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *AddGroupReply) GetError() string {
if x != nil {
return x.Error
}
return ""
}
type DelGroupRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
IsGroup bool `protobuf:"varint,2,opt,name=is_group,json=isGroup,proto3" json:"is_group,omitempty"`
GroupId uint32 `protobuf:"varint,3,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
}
func (x *DelGroupRequest) Reset() {
*x = DelGroupRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_accounting_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DelGroupRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DelGroupRequest) ProtoMessage() {}
func (x *DelGroupRequest) ProtoReflect() protoreflect.Message {
mi := &file_accounting_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 DelGroupRequest.ProtoReflect.Descriptor instead.
func (*DelGroupRequest) Descriptor() ([]byte, []int) {
return file_accounting_proto_rawDescGZIP(), []int{6}
}
func (x *DelGroupRequest) GetId() uint32 {
if x != nil {
return x.Id
}
return 0
}
func (x *DelGroupRequest) GetIsGroup() bool {
if x != nil {
return x.IsGroup
}
return false
}
func (x *DelGroupRequest) GetGroupId() uint32 {
if x != nil {
return x.GroupId
}
return 0
}
type DelGroupReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
}
func (x *DelGroupReply) Reset() {
*x = DelGroupReply{}
if protoimpl.UnsafeEnabled {
mi := &file_accounting_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DelGroupReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DelGroupReply) ProtoMessage() {}
func (x *DelGroupReply) ProtoReflect() protoreflect.Message {
mi := &file_accounting_proto_msgTypes[7]
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 DelGroupReply.ProtoReflect.Descriptor instead.
func (*DelGroupReply) Descriptor() ([]byte, []int) {
return file_accounting_proto_rawDescGZIP(), []int{7}
}
func (x *DelGroupReply) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *DelGroupReply) GetError() string {
if x != nil {
return x.Error
}
return ""
}
var File_accounting_proto protoreflect.FileDescriptor
var file_accounting_proto_rawDesc = []byte{
0x0a, 0x10, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x4d,
0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19,
0x0a, 0x08, 0x69, 0x73, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08,
0x52, 0x07, 0x69, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x75, 0x6c,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x22, 0x3a, 0x0a,
0x0a, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x61,
0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x63,
0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x5d, 0x0a, 0x0a, 0x53, 0x65, 0x74,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x67, 0x72,
0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x47, 0x72, 0x6f,
0x75, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x04, 0x20,
0x01, 0x28, 0x05, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x3a, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x52,
0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18,
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x14,
0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,
0x72, 0x72, 0x6f, 0x72, 0x22, 0x57, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x67, 0x72,
0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x47, 0x72, 0x6f,
0x75, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x3f, 0x0a,
0x0d, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18,
0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f,
0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x57,
0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69,
0x64, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20,
0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x19, 0x0a, 0x08,
0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07,
0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x3f, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x47, 0x72,
0x6f, 0x75, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63,
0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x32, 0x90, 0x02, 0x0a, 0x0a, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3b, 0x0a, 0x05, 0x41, 0x6c, 0x6c, 0x6f, 0x77,
0x12, 0x18, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x6c,
0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x61, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x70,
0x6c, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x07, 0x53, 0x65, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x12,
0x16, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x65, 0x74,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12,
0x44, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1b, 0x2e, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75,
0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65,
0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x08, 0x44, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75,
0x70, 0x12, 0x1b, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x44,
0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19,
0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x47,
0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x0e, 0x5a, 0x0c, 0x2e,
0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_accounting_proto_rawDescOnce sync.Once
file_accounting_proto_rawDescData = file_accounting_proto_rawDesc
)
func file_accounting_proto_rawDescGZIP() []byte {
file_accounting_proto_rawDescOnce.Do(func() {
file_accounting_proto_rawDescData = protoimpl.X.CompressGZIP(file_accounting_proto_rawDescData)
})
return file_accounting_proto_rawDescData
}
var file_accounting_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_accounting_proto_goTypes = []interface{}{
(*AllowRequest)(nil), // 0: accounting.AllowRequest
(*AllowReply)(nil), // 1: accounting.AllowReply
(*SetRequest)(nil), // 2: accounting.SetRequest
(*SetReply)(nil), // 3: accounting.SetReply
(*AddGroupRequest)(nil), // 4: accounting.AddGroupRequest
(*AddGroupReply)(nil), // 5: accounting.AddGroupReply
(*DelGroupRequest)(nil), // 6: accounting.DelGroupRequest
(*DelGroupReply)(nil), // 7: accounting.DelGroupReply
}
var file_accounting_proto_depIdxs = []int32{
0, // 0: accounting.Accounting.Allow:input_type -> accounting.AllowRequest
2, // 1: accounting.Accounting.SetRule:input_type -> accounting.SetRequest
4, // 2: accounting.Accounting.AddGroup:input_type -> accounting.AddGroupRequest
6, // 3: accounting.Accounting.DelGroup:input_type -> accounting.DelGroupRequest
1, // 4: accounting.Accounting.Allow:output_type -> accounting.AllowReply
3, // 5: accounting.Accounting.SetRule:output_type -> accounting.SetReply
5, // 6: accounting.Accounting.AddGroup:output_type -> accounting.AddGroupReply
7, // 7: accounting.Accounting.DelGroup:output_type -> accounting.DelGroupReply
4, // [4:8] is the sub-list for method output_type
0, // [0:4] 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_accounting_proto_init() }
func file_accounting_proto_init() {
if File_accounting_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_accounting_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AllowRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accounting_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AllowReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accounting_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accounting_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accounting_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddGroupRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accounting_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddGroupReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accounting_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DelGroupRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accounting_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DelGroupReply); 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_accounting_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_accounting_proto_goTypes,
DependencyIndexes: file_accounting_proto_depIdxs,
MessageInfos: file_accounting_proto_msgTypes,
}.Build()
File_accounting_proto = out.File
file_accounting_proto_rawDesc = nil
file_accounting_proto_goTypes = nil
file_accounting_proto_depIdxs = nil
}

View file

@ -0,0 +1,57 @@
syntax = "proto3";
option go_package = "./accounting";
package accounting;
// The greeting service definition.
service Accounting {
// Sends a greeting
rpc Allow (AllowRequest) returns (AllowReply) {}
rpc SetRule (SetRequest) returns (SetReply) {}
rpc AddGroup (AddGroupRequest) returns (AddGroupReply) {}
rpc DelGroup (DelGroupRequest) returns (DelGroupReply) {}
}
message AllowRequest {
uint32 id = 1;
bool is_group = 2;
string rule = 3;
}
message AllowReply {
bool access = 1;
string error = 2;
}
message SetRequest {
uint32 id = 1;
bool is_group = 2;
string rule = 3;
int32 val = 4;
}
message SetReply {
bool success = 1;
string error = 2;
}
message AddGroupRequest {
uint32 id = 1;
bool is_group = 2;
uint32 group_id = 3;
}
message AddGroupReply {
bool success = 1;
string error = 2;
}
message DelGroupRequest {
uint32 id = 1;
bool is_group = 2;
uint32 group_id = 3;
}
message DelGroupReply {
bool success = 1;
string error = 2;
}

View file

@ -0,0 +1,222 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.6.1
// source: accounting.proto
package accounting
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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Accounting_Allow_FullMethodName = "/accounting.Accounting/Allow"
Accounting_SetRule_FullMethodName = "/accounting.Accounting/SetRule"
Accounting_AddGroup_FullMethodName = "/accounting.Accounting/AddGroup"
Accounting_DelGroup_FullMethodName = "/accounting.Accounting/DelGroup"
)
// AccountingClient is the client API for Accounting 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 AccountingClient interface {
// Sends a greeting
Allow(ctx context.Context, in *AllowRequest, opts ...grpc.CallOption) (*AllowReply, error)
SetRule(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetReply, error)
AddGroup(ctx context.Context, in *AddGroupRequest, opts ...grpc.CallOption) (*AddGroupReply, error)
DelGroup(ctx context.Context, in *DelGroupRequest, opts ...grpc.CallOption) (*DelGroupReply, error)
}
type accountingClient struct {
cc grpc.ClientConnInterface
}
func NewAccountingClient(cc grpc.ClientConnInterface) AccountingClient {
return &accountingClient{cc}
}
func (c *accountingClient) Allow(ctx context.Context, in *AllowRequest, opts ...grpc.CallOption) (*AllowReply, error) {
out := new(AllowReply)
err := c.cc.Invoke(ctx, Accounting_Allow_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountingClient) SetRule(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetReply, error) {
out := new(SetReply)
err := c.cc.Invoke(ctx, Accounting_SetRule_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountingClient) AddGroup(ctx context.Context, in *AddGroupRequest, opts ...grpc.CallOption) (*AddGroupReply, error) {
out := new(AddGroupReply)
err := c.cc.Invoke(ctx, Accounting_AddGroup_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountingClient) DelGroup(ctx context.Context, in *DelGroupRequest, opts ...grpc.CallOption) (*DelGroupReply, error) {
out := new(DelGroupReply)
err := c.cc.Invoke(ctx, Accounting_DelGroup_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// AccountingServer is the server API for Accounting service.
// All implementations must embed UnimplementedAccountingServer
// for forward compatibility
type AccountingServer interface {
// Sends a greeting
Allow(context.Context, *AllowRequest) (*AllowReply, error)
SetRule(context.Context, *SetRequest) (*SetReply, error)
AddGroup(context.Context, *AddGroupRequest) (*AddGroupReply, error)
DelGroup(context.Context, *DelGroupRequest) (*DelGroupReply, error)
mustEmbedUnimplementedAccountingServer()
}
// UnimplementedAccountingServer must be embedded to have forward compatible implementations.
type UnimplementedAccountingServer struct {
}
func (UnimplementedAccountingServer) Allow(context.Context, *AllowRequest) (*AllowReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Allow not implemented")
}
func (UnimplementedAccountingServer) SetRule(context.Context, *SetRequest) (*SetReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetRule not implemented")
}
func (UnimplementedAccountingServer) AddGroup(context.Context, *AddGroupRequest) (*AddGroupReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddGroup not implemented")
}
func (UnimplementedAccountingServer) DelGroup(context.Context, *DelGroupRequest) (*DelGroupReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelGroup not implemented")
}
func (UnimplementedAccountingServer) mustEmbedUnimplementedAccountingServer() {}
// UnsafeAccountingServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AccountingServer will
// result in compilation errors.
type UnsafeAccountingServer interface {
mustEmbedUnimplementedAccountingServer()
}
func RegisterAccountingServer(s grpc.ServiceRegistrar, srv AccountingServer) {
s.RegisterService(&Accounting_ServiceDesc, srv)
}
func _Accounting_Allow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AllowRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountingServer).Allow(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Accounting_Allow_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountingServer).Allow(ctx, req.(*AllowRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Accounting_SetRule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountingServer).SetRule(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Accounting_SetRule_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountingServer).SetRule(ctx, req.(*SetRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Accounting_AddGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddGroupRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountingServer).AddGroup(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Accounting_AddGroup_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountingServer).AddGroup(ctx, req.(*AddGroupRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Accounting_DelGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DelGroupRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountingServer).DelGroup(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Accounting_DelGroup_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountingServer).DelGroup(ctx, req.(*DelGroupRequest))
}
return interceptor(ctx, in, info, handler)
}
// Accounting_ServiceDesc is the grpc.ServiceDesc for Accounting service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Accounting_ServiceDesc = grpc.ServiceDesc{
ServiceName: "accounting.Accounting",
HandlerType: (*AccountingServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Allow",
Handler: _Accounting_Allow_Handler,
},
{
MethodName: "SetRule",
Handler: _Accounting_SetRule_Handler,
},
{
MethodName: "AddGroup",
Handler: _Accounting_AddGroup_Handler,
},
{
MethodName: "DelGroup",
Handler: _Accounting_DelGroup_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "accounting.proto",
}