book

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MulanPSL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "book"
)

Variables

View Source
var (
	Catalog_name = map[int32]string{
		0: "TECH",
		1: "EDU",
	}
	Catalog_value = map[string]int32{
		"TECH": 0,
		"EDU":  1,
	}
)

Enum value maps for Catalog.

View Source
var File_pb_book_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "demo.book.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateBook",
			Handler:    _Service_CreateBook_Handler,
		},
		{
			MethodName: "QueryBook",
			Handler:    _Service_QueryBook_Handler,
		},
		{
			MethodName: "DescribeBook",
			Handler:    _Service_DescribeBook_Handler,
		},
		{
			MethodName: "UpdateBook",
			Handler:    _Service_UpdateBook_Handler,
		},
		{
			MethodName: "DeleteBook",
			Handler:    _Service_DeleteBook_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pb/book.proto",
}

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

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type Book

type Book struct {

	// 唯一ID
	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// 录入时间
	// @gotags: json:"create_at"
	CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at"`
	// 更新时间
	// @gotags: json:"update_at"
	UpdateAt int64 `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at"`
	// 更新人
	// @gotags: json:"update_by"
	UpdateBy string `protobuf:"bytes,4,opt,name=update_by,json=updateBy,proto3" json:"update_by"`
	// 书本信息
	// @gotags: json:"data"
	Data *CreateBookRequest `protobuf:"bytes,5,opt,name=data,proto3" json:"data"`
	// contains filtered or unexported fields
}

Book todo

func NewBook

func NewBook(req *CreateBookRequest) (*Book, error)

func (*Book) Descriptor deprecated

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

Deprecated: Use Book.ProtoReflect.Descriptor instead.

func (*Book) GetCreateAt

func (x *Book) GetCreateAt() int64

func (*Book) GetData

func (x *Book) GetData() *CreateBookRequest

func (*Book) GetId

func (x *Book) GetId() string

func (*Book) GetUpdateAt

func (x *Book) GetUpdateAt() int64

func (*Book) GetUpdateBy

func (x *Book) GetUpdateBy() string

func (*Book) ProtoMessage

func (*Book) ProtoMessage()

func (*Book) ProtoReflect

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

func (*Book) Reset

func (x *Book) Reset()

func (*Book) String

func (x *Book) String() string

type BookSet

type BookSet struct {

	// 分页时,返回总数量
	// @gotags: json:"total"
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"`
	// 一页的数据
	// @gotags: json:"items"
	Items []*Book `protobuf:"bytes,2,rep,name=items,proto3" json:"items"`
	// contains filtered or unexported fields
}

BookSet todo

func (*BookSet) Descriptor deprecated

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

Deprecated: Use BookSet.ProtoReflect.Descriptor instead.

func (*BookSet) GetItems

func (x *BookSet) GetItems() []*Book

func (*BookSet) GetTotal

func (x *BookSet) GetTotal() int64

func (*BookSet) ProtoMessage

func (*BookSet) ProtoMessage()

func (*BookSet) ProtoReflect

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

func (*BookSet) Reset

func (x *BookSet) Reset()

func (*BookSet) String

func (x *BookSet) String() string

type Catalog

type Catalog int32
const (
	Catalog_TECH Catalog = 0
	Catalog_EDU  Catalog = 1
)

func ParseCatalogFromString

func ParseCatalogFromString(str string) (Catalog, error)

ParseCatalogFromString Parse Catalog from string

func (Catalog) Descriptor

func (Catalog) Descriptor() protoreflect.EnumDescriptor

func (Catalog) Enum

func (x Catalog) Enum() *Catalog

func (Catalog) EnumDescriptor deprecated

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

Deprecated: Use Catalog.Descriptor instead.

func (Catalog) Equal

func (t Catalog) Equal(target Catalog) bool

Equal type compare

func (Catalog) IsIn

func (t Catalog) IsIn(targets ...Catalog) bool

IsIn todo

func (Catalog) MarshalJSON

func (t Catalog) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (Catalog) Number

func (x Catalog) Number() protoreflect.EnumNumber

func (Catalog) String

func (x Catalog) String() string

func (Catalog) Type

func (Catalog) Type() protoreflect.EnumType

func (*Catalog) UnmarshalJSON

func (t *Catalog) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type CreateBookRequest

type CreateBookRequest struct {

	// 创建人
	// @gotags: json:"create_by"
	CreateBy string `protobuf:"bytes,1,opt,name=create_by,json=createBy,proto3" json:"create_by"`
	// 名称
	// @gotags: json:"name" validate:"required"
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name" validate:"required"`
	// 作者
	// @gotags: json:"author" validate:"required"
	Author string `protobuf:"bytes,3,opt,name=author,proto3" json:"author" validate:"required"`
	// contains filtered or unexported fields
}

func NewCreateBookRequest

func NewCreateBookRequest() *CreateBookRequest

func (*CreateBookRequest) Descriptor deprecated

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

Deprecated: Use CreateBookRequest.ProtoReflect.Descriptor instead.

func (*CreateBookRequest) GetAuthor

func (x *CreateBookRequest) GetAuthor() string

func (*CreateBookRequest) GetCreateBy

func (x *CreateBookRequest) GetCreateBy() string

func (*CreateBookRequest) GetName

func (x *CreateBookRequest) GetName() string

func (*CreateBookRequest) ProtoMessage

func (*CreateBookRequest) ProtoMessage()

func (*CreateBookRequest) ProtoReflect

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

func (*CreateBookRequest) Reset

func (x *CreateBookRequest) Reset()

func (*CreateBookRequest) String

func (x *CreateBookRequest) String() string

func (*CreateBookRequest) Validate

func (req *CreateBookRequest) Validate() error

type DeleteBookRequest

type DeleteBookRequest struct {

	// book id
	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// contains filtered or unexported fields
}

func (*DeleteBookRequest) Descriptor deprecated

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

Deprecated: Use DeleteBookRequest.ProtoReflect.Descriptor instead.

func (*DeleteBookRequest) GetId

func (x *DeleteBookRequest) GetId() string

func (*DeleteBookRequest) ProtoMessage

func (*DeleteBookRequest) ProtoMessage()

func (*DeleteBookRequest) ProtoReflect

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

func (*DeleteBookRequest) Reset

func (x *DeleteBookRequest) Reset()

func (*DeleteBookRequest) String

func (x *DeleteBookRequest) String() string

type DescribeBookRequest

type DescribeBookRequest struct {

	// book id
	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// contains filtered or unexported fields
}

func (*DescribeBookRequest) Descriptor deprecated

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

Deprecated: Use DescribeBookRequest.ProtoReflect.Descriptor instead.

func (*DescribeBookRequest) GetId

func (x *DescribeBookRequest) GetId() string

func (*DescribeBookRequest) ProtoMessage

func (*DescribeBookRequest) ProtoMessage()

func (*DescribeBookRequest) ProtoReflect

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

func (*DescribeBookRequest) Reset

func (x *DescribeBookRequest) Reset()

func (*DescribeBookRequest) String

func (x *DescribeBookRequest) String() string

type QueryBookRequest

type QueryBookRequest struct {

	// 分页参数, <package_name>.<message_name>
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// 关键字参数
	// @gotags: json:"keywords"
	Keywords string `protobuf:"bytes,2,opt,name=keywords,proto3" json:"keywords"`
	// contains filtered or unexported fields
}

func (*QueryBookRequest) Descriptor deprecated

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

Deprecated: Use QueryBookRequest.ProtoReflect.Descriptor instead.

func (*QueryBookRequest) GetKeywords

func (x *QueryBookRequest) GetKeywords() string

func (*QueryBookRequest) GetPage

func (x *QueryBookRequest) GetPage() *request.PageRequest

func (*QueryBookRequest) ProtoMessage

func (*QueryBookRequest) ProtoMessage()

func (*QueryBookRequest) ProtoReflect

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

func (*QueryBookRequest) Reset

func (x *QueryBookRequest) Reset()

func (*QueryBookRequest) String

func (x *QueryBookRequest) String() string

type ServiceClient

type ServiceClient interface {
	CreateBook(ctx context.Context, in *CreateBookRequest, opts ...grpc.CallOption) (*Book, error)
	QueryBook(ctx context.Context, in *QueryBookRequest, opts ...grpc.CallOption) (*BookSet, error)
	DescribeBook(ctx context.Context, in *DescribeBookRequest, opts ...grpc.CallOption) (*Book, error)
	UpdateBook(ctx context.Context, in *UpdateBookRequest, opts ...grpc.CallOption) (*Book, error)
	DeleteBook(ctx context.Context, in *DeleteBookRequest, opts ...grpc.CallOption) (*Book, error)
}

ServiceClient is the client API for Service 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 NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	CreateBook(context.Context, *CreateBookRequest) (*Book, error)
	QueryBook(context.Context, *QueryBookRequest) (*BookSet, error)
	DescribeBook(context.Context, *DescribeBookRequest) (*Book, error)
	UpdateBook(context.Context, *UpdateBookRequest) (*Book, error)
	DeleteBook(context.Context, *DeleteBookRequest) (*Book, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) CreateBook

func (UnimplementedServiceServer) DeleteBook

func (UnimplementedServiceServer) DescribeBook

func (UnimplementedServiceServer) QueryBook

func (UnimplementedServiceServer) UpdateBook

type UnsafeServiceServer

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

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

type UpdateBookRequest

type UpdateBookRequest struct {

	// book id
	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// 更新模式
	// @gotags: json:"update_mode"
	UpdateMode request1.UpdateMode `protobuf:"varint,2,opt,name=update_mode,json=updateMode,proto3,enum=infraboard.mcube.request.UpdateMode" json:"update_mode"`
	// 更新人
	// @gotags: json:"update_by"
	UpdateBy string `protobuf:"bytes,3,opt,name=update_by,json=updateBy,proto3" json:"update_by"`
	// 更新时间
	// @gotags: json:"update_at"
	UpdateAt int64 `protobuf:"varint,4,opt,name=update_at,json=updateAt,proto3" json:"update_at"`
	// 更新的书本信息
	// @gotags: json:"data"
	Data *CreateBookRequest `protobuf:"bytes,5,opt,name=data,proto3" json:"data"`
	// contains filtered or unexported fields
}

func (*UpdateBookRequest) Descriptor deprecated

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

Deprecated: Use UpdateBookRequest.ProtoReflect.Descriptor instead.

func (*UpdateBookRequest) GetData

func (x *UpdateBookRequest) GetData() *CreateBookRequest

func (*UpdateBookRequest) GetId

func (x *UpdateBookRequest) GetId() string

func (*UpdateBookRequest) GetUpdateAt

func (x *UpdateBookRequest) GetUpdateAt() int64

func (*UpdateBookRequest) GetUpdateBy

func (x *UpdateBookRequest) GetUpdateBy() string

func (*UpdateBookRequest) GetUpdateMode

func (x *UpdateBookRequest) GetUpdateMode() request1.UpdateMode

func (*UpdateBookRequest) ProtoMessage

func (*UpdateBookRequest) ProtoMessage()

func (*UpdateBookRequest) ProtoReflect

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

func (*UpdateBookRequest) Reset

func (x *UpdateBookRequest) Reset()

func (*UpdateBookRequest) String

func (x *UpdateBookRequest) String() string

Jump to

Keyboard shortcuts

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