book

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MulanPSL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPageSize 默认分页大小
	DefaultPageSize = 20
	// DefaultPageNumber 默认页号
	DefaultPageNumber = 1
)
View Source
const (
	AppName = "book"
)

Variables

View Source
var (
	UpdateMode_name = map[int32]string{
		0: "PUT",
		1: "PATCH",
	}
	UpdateMode_value = map[string]int32{
		"PUT":   0,
		"PATCH": 1,
	}
)

Enum value maps for UpdateMode.

View Source
var File_apps_book_pb_book_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "zginkgo.ginkgo_keyauth.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: "apps/book/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" bson:"_id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
	// 录入时间
	// @gotags: json:"create_at" bson:"create_at"
	CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at" bson:"create_at"`
	// 更新时间
	// @gotags: json:"update_at" bson:"update_at"
	UpdateAt int64 `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at" bson:"update_at"`
	// 更新人
	// @gotags: json:"update_by" bson:"update_by"
	UpdateBy string `protobuf:"bytes,4,opt,name=update_by,json=updateBy,proto3" json:"update_by" bson:"update_by"`
	// 书本信息
	// @gotags: json:"data" bson:"data"
	Data *CreateBookRequest `protobuf:"bytes,5,opt,name=data,proto3" json:"data" bson:"data"`
	// contains filtered or unexported fields
}

Book todo

func NewBook

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

func NewDefaultBook

func NewDefaultBook() *Book

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) Patch

func (i *Book) Patch(req *UpdateBookRequest) error

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

func (*Book) Update

func (i *Book) Update(req *UpdateBookRequest)

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 NewBookSet

func NewBookSet() *BookSet

func (*BookSet) Add

func (s *BookSet) Add(item *Book)

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 CreateBookRequest

type CreateBookRequest struct {

	// 创建人
	// @gotags: json:"create_by" bson:"create_by"
	CreateBy string `protobuf:"bytes,1,opt,name=create_by,json=createBy,proto3" json:"create_by" bson:"create_by"`
	// 名称
	// @gotags: json:"name" bson:"name" validate:"required"
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name" bson:"name" validate:"required"`
	// 作者
	// @gotags: json:"author" bson:"author" validate:"required"
	Author string `protobuf:"bytes,3,opt,name=author,proto3" json:"author" bson:"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 NewDeleteBookRequestWithID

func NewDeleteBookRequestWithID(id string) *DeleteBookRequest

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 NewDescribeBookRequest

func NewDescribeBookRequest(id string) *DescribeBookRequest

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 PageRequest

type PageRequest struct {
	PageSize   uint64 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	PageNumber uint64 `protobuf:"varint,2,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
	Offset     int64  `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
	// contains filtered or unexported fields
}

func NewDefaultPageRequest

func NewDefaultPageRequest() *PageRequest

func NewPageRequest

func NewPageRequest(ps uint, pn uint) *PageRequest

NewPageRequest 实例化

func NewPageRequestFromHTTP

func NewPageRequestFromHTTP(req *http.Request) *PageRequest

NewPageRequestFromHTTP 从HTTP请求中加载分页请求

func (*PageRequest) Descriptor deprecated

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

Deprecated: Use PageRequest.ProtoReflect.Descriptor instead.

func (*PageRequest) GetOffset

func (x *PageRequest) GetOffset() int64

func (*PageRequest) GetPageNumber

func (x *PageRequest) GetPageNumber() uint64

func (*PageRequest) GetPageSize

func (x *PageRequest) GetPageSize() uint64

func (*PageRequest) ProtoMessage

func (*PageRequest) ProtoMessage()

func (*PageRequest) ProtoReflect

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

func (*PageRequest) Reset

func (x *PageRequest) Reset()

func (*PageRequest) String

func (x *PageRequest) String() string

type QueryBookRequest

type QueryBookRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *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 NewQueryBookRequest

func NewQueryBookRequest() *QueryBookRequest

func NewQueryBookRequestFromHTTP

func NewQueryBookRequestFromHTTP(r *http.Request) *QueryBookRequest

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() *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 UpdateMode `` /* 126-byte string literal not displayed */
	// 更新人
	// @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 NewPatchBookRequest

func NewPatchBookRequest(id string) *UpdateBookRequest

func NewPutBookRequest

func NewPutBookRequest(id string) *UpdateBookRequest

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

type UpdateMode

type UpdateMode int32
const (
	UpdateMode_PUT   UpdateMode = 0
	UpdateMode_PATCH UpdateMode = 1
)

func (UpdateMode) Descriptor

func (UpdateMode) Descriptor() protoreflect.EnumDescriptor

func (UpdateMode) Enum

func (x UpdateMode) Enum() *UpdateMode

func (UpdateMode) EnumDescriptor deprecated

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

Deprecated: Use UpdateMode.Descriptor instead.

func (UpdateMode) Number

func (x UpdateMode) Number() protoreflect.EnumNumber

func (UpdateMode) String

func (x UpdateMode) String() string

func (UpdateMode) Type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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