Documentation
¶
Index ¶
- Constants
- func NewCatalogEndpoints() []*api.Endpoint
- func RegisterCatalogHandler(s server.Server, hdlr CatalogHandler, opts ...server.HandlerOption) error
- type Catalog
- func (c *Catalog) Delete(ctx context.Context, req *DeleteReq, res *DeleteRes) error
- func (c *Catalog) FindByID(ctx context.Context, req *FindByIDReq, res *FindByIDRes) error
- func (c *Catalog) Init(sqlDB *bun.DB)
- func (c *Catalog) List(ctx context.Context, req *ListReq, res *ListRes) error
- func (c *Catalog) Set(ctx context.Context, req *SetReq, res *SetRes) error
- type CatalogHandler
- type CatalogService
- type DeleteReq
- func (*DeleteReq) Descriptor() ([]byte, []int)
- func (m *DeleteReq) GetProductId() string
- func (*DeleteReq) ProtoMessage()
- func (m *DeleteReq) Reset()
- func (m *DeleteReq) String() string
- func (m *DeleteReq) XXX_DiscardUnknown()
- func (m *DeleteReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DeleteReq) XXX_Merge(src proto.Message)
- func (m *DeleteReq) XXX_Size() int
- func (m *DeleteReq) XXX_Unmarshal(b []byte) error
- type DeleteRes
- func (*DeleteRes) Descriptor() ([]byte, []int)
- func (*DeleteRes) ProtoMessage()
- func (m *DeleteRes) Reset()
- func (m *DeleteRes) String() string
- func (m *DeleteRes) XXX_DiscardUnknown()
- func (m *DeleteRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DeleteRes) XXX_Merge(src proto.Message)
- func (m *DeleteRes) XXX_Size() int
- func (m *DeleteRes) XXX_Unmarshal(b []byte) error
- type FindByIDReq
- func (*FindByIDReq) Descriptor() ([]byte, []int)
- func (m *FindByIDReq) GetProductIds() []string
- func (*FindByIDReq) ProtoMessage()
- func (m *FindByIDReq) Reset()
- func (m *FindByIDReq) String() string
- func (m *FindByIDReq) XXX_DiscardUnknown()
- func (m *FindByIDReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FindByIDReq) XXX_Merge(src proto.Message)
- func (m *FindByIDReq) XXX_Size() int
- func (m *FindByIDReq) XXX_Unmarshal(b []byte) error
- type FindByIDRes
- func (*FindByIDRes) Descriptor() ([]byte, []int)
- func (m *FindByIDRes) GetProducts() []*Product
- func (*FindByIDRes) ProtoMessage()
- func (m *FindByIDRes) Reset()
- func (m *FindByIDRes) String() string
- func (m *FindByIDRes) XXX_DiscardUnknown()
- func (m *FindByIDRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FindByIDRes) XXX_Merge(src proto.Message)
- func (m *FindByIDRes) XXX_Size() int
- func (m *FindByIDRes) XXX_Unmarshal(b []byte) error
- type ListReq
- func (*ListReq) Descriptor() ([]byte, []int)
- func (*ListReq) ProtoMessage()
- func (m *ListReq) Reset()
- func (m *ListReq) String() string
- func (m *ListReq) XXX_DiscardUnknown()
- func (m *ListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ListReq) XXX_Merge(src proto.Message)
- func (m *ListReq) XXX_Size() int
- func (m *ListReq) XXX_Unmarshal(b []byte) error
- type ListRes
- func (*ListRes) Descriptor() ([]byte, []int)
- func (m *ListRes) GetProducts() []*Product
- func (*ListRes) ProtoMessage()
- func (m *ListRes) Reset()
- func (m *ListRes) String() string
- func (m *ListRes) XXX_DiscardUnknown()
- func (m *ListRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ListRes) XXX_Merge(src proto.Message)
- func (m *ListRes) XXX_Size() int
- func (m *ListRes) XXX_Unmarshal(b []byte) error
- type Prod
- type Product
- func (*Product) Descriptor() ([]byte, []int)
- func (m *Product) GetCreatedAt() int64
- func (m *Product) GetDeletedAt() int64
- func (m *Product) GetId() string
- func (m *Product) GetName() string
- func (m *Product) GetOperator() string
- func (m *Product) GetPriceCent() int32
- func (m *Product) GetSnapshot() uint64
- func (m *Product) GetUpdatedAt() int64
- func (*Product) ProtoMessage()
- func (m *Product) Reset()
- func (m *Product) String() string
- func (m *Product) XXX_DiscardUnknown()
- func (m *Product) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Product) XXX_Merge(src proto.Message)
- func (m *Product) XXX_Size() int
- func (m *Product) XXX_Unmarshal(b []byte) error
- type Server
- type SetReq
- func (*SetReq) Descriptor() ([]byte, []int)
- func (m *SetReq) GetProduct() *Product
- func (*SetReq) ProtoMessage()
- func (m *SetReq) Reset()
- func (m *SetReq) String() string
- func (m *SetReq) XXX_DiscardUnknown()
- func (m *SetReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SetReq) XXX_Merge(src proto.Message)
- func (m *SetReq) XXX_Size() int
- func (m *SetReq) XXX_Unmarshal(b []byte) error
- type SetRes
- func (*SetRes) Descriptor() ([]byte, []int)
- func (*SetRes) ProtoMessage()
- func (m *SetRes) Reset()
- func (m *SetRes) String() string
- func (m *SetRes) XXX_DiscardUnknown()
- func (m *SetRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SetRes) XXX_Merge(src proto.Message)
- func (m *SetRes) XXX_Size() int
- func (m *SetRes) XXX_Unmarshal(b []byte) error
Constants ¶
View Source
const (
ServiceName = "catalog"
)
Variables ¶
This section is empty.
Functions ¶
func NewCatalogEndpoints ¶
func RegisterCatalogHandler ¶
func RegisterCatalogHandler(s server.Server, hdlr CatalogHandler, opts ...server.HandlerOption) error
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
func (*Catalog) FindByID ¶
func (c *Catalog) FindByID(ctx context.Context, req *FindByIDReq, res *FindByIDRes) error
type CatalogHandler ¶
type CatalogService ¶
type CatalogService interface { // 列出所有的产品 List(ctx context.Context, in *ListReq, opts ...client.CallOption) (*ListRes, error) // 增加或者更新产品信息 Set(ctx context.Context, in *SetReq, opts ...client.CallOption) (*SetRes, error) // 删除产品 Delete(ctx context.Context, in *DeleteReq, opts ...client.CallOption) (*DeleteRes, error) // 根据产品 ID 查询 FindByID(ctx context.Context, in *FindByIDReq, opts ...client.CallOption) (*FindByIDRes, error) }
func NewCatalogService ¶
func NewCatalogService(name string, c client.Client) CatalogService
type DeleteReq ¶
type DeleteReq struct { ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*DeleteReq) Descriptor ¶
func (*DeleteReq) GetProductId ¶
func (*DeleteReq) ProtoMessage ¶
func (*DeleteReq) ProtoMessage()
func (*DeleteReq) XXX_DiscardUnknown ¶
func (m *DeleteReq) XXX_DiscardUnknown()
func (*DeleteReq) XXX_Marshal ¶
func (*DeleteReq) XXX_Unmarshal ¶
type DeleteRes ¶
type DeleteRes struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*DeleteRes) Descriptor ¶
func (*DeleteRes) ProtoMessage ¶
func (*DeleteRes) ProtoMessage()
func (*DeleteRes) XXX_DiscardUnknown ¶
func (m *DeleteRes) XXX_DiscardUnknown()
func (*DeleteRes) XXX_Marshal ¶
func (*DeleteRes) XXX_Unmarshal ¶
type FindByIDReq ¶
type FindByIDReq struct { ProductIds []string `protobuf:"bytes,1,rep,name=product_ids,json=productIds,proto3" json:"product_ids,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*FindByIDReq) Descriptor ¶
func (*FindByIDReq) Descriptor() ([]byte, []int)
func (*FindByIDReq) GetProductIds ¶
func (m *FindByIDReq) GetProductIds() []string
func (*FindByIDReq) ProtoMessage ¶
func (*FindByIDReq) ProtoMessage()
func (*FindByIDReq) Reset ¶
func (m *FindByIDReq) Reset()
func (*FindByIDReq) String ¶
func (m *FindByIDReq) String() string
func (*FindByIDReq) XXX_DiscardUnknown ¶
func (m *FindByIDReq) XXX_DiscardUnknown()
func (*FindByIDReq) XXX_Marshal ¶
func (m *FindByIDReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FindByIDReq) XXX_Merge ¶
func (m *FindByIDReq) XXX_Merge(src proto.Message)
func (*FindByIDReq) XXX_Size ¶
func (m *FindByIDReq) XXX_Size() int
func (*FindByIDReq) XXX_Unmarshal ¶
func (m *FindByIDReq) XXX_Unmarshal(b []byte) error
type FindByIDRes ¶
type FindByIDRes struct { Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*FindByIDRes) Descriptor ¶
func (*FindByIDRes) Descriptor() ([]byte, []int)
func (*FindByIDRes) GetProducts ¶
func (m *FindByIDRes) GetProducts() []*Product
func (*FindByIDRes) ProtoMessage ¶
func (*FindByIDRes) ProtoMessage()
func (*FindByIDRes) Reset ¶
func (m *FindByIDRes) Reset()
func (*FindByIDRes) String ¶
func (m *FindByIDRes) String() string
func (*FindByIDRes) XXX_DiscardUnknown ¶
func (m *FindByIDRes) XXX_DiscardUnknown()
func (*FindByIDRes) XXX_Marshal ¶
func (m *FindByIDRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FindByIDRes) XXX_Merge ¶
func (m *FindByIDRes) XXX_Merge(src proto.Message)
func (*FindByIDRes) XXX_Size ¶
func (m *FindByIDRes) XXX_Size() int
func (*FindByIDRes) XXX_Unmarshal ¶
func (m *FindByIDRes) XXX_Unmarshal(b []byte) error
type ListReq ¶
type ListReq struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ListReq) Descriptor ¶
func (*ListReq) ProtoMessage ¶
func (*ListReq) ProtoMessage()
func (*ListReq) XXX_DiscardUnknown ¶
func (m *ListReq) XXX_DiscardUnknown()
func (*ListReq) XXX_Marshal ¶
func (*ListReq) XXX_Unmarshal ¶
type ListRes ¶
type ListRes struct { Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ListRes) Descriptor ¶
func (*ListRes) GetProducts ¶
func (*ListRes) ProtoMessage ¶
func (*ListRes) ProtoMessage()
func (*ListRes) XXX_DiscardUnknown ¶
func (m *ListRes) XXX_DiscardUnknown()
func (*ListRes) XXX_Marshal ¶
func (*ListRes) XXX_Unmarshal ¶
type Prod ¶
type Prod struct { bun.BaseModel `bun:"products,alias:p"` Snapshot uint64 `bun:",pk"` ID string Name string Price int32 CreatedAt time.Time UpdatedAt time.Time DeletedAt time.Time Operator string }
func (*Prod) AfterCreateTable ¶
type Product ¶
type Product struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` PriceCent int32 `protobuf:"varint,3,opt,name=price_cent,json=priceCent,proto3" json:"price_cent,omitempty"` // 产品快照编号:记录历史时间线上的一个产品,被订单所引用。 Snapshot uint64 `protobuf:"varint,1001,opt,name=snapshot,proto3" json:"snapshot,omitempty"` CreatedAt int64 `protobuf:"varint,1002,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` UpdatedAt int64 `protobuf:"varint,1003,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` DeletedAt int64 `protobuf:"varint,1004,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` Operator string `protobuf:"bytes,1005,opt,name=operator,proto3" json:"operator,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Product) Descriptor ¶
func (*Product) GetCreatedAt ¶
func (*Product) GetDeletedAt ¶
func (*Product) GetOperator ¶
func (*Product) GetPriceCent ¶
func (*Product) GetSnapshot ¶
func (*Product) GetUpdatedAt ¶
func (*Product) ProtoMessage ¶
func (*Product) ProtoMessage()
func (*Product) XXX_DiscardUnknown ¶
func (m *Product) XXX_DiscardUnknown()
func (*Product) XXX_Marshal ¶
func (*Product) XXX_Unmarshal ¶
type Server ¶
type SetReq ¶
type SetReq struct { Product *Product `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SetReq) Descriptor ¶
func (*SetReq) GetProduct ¶
func (*SetReq) ProtoMessage ¶
func (*SetReq) ProtoMessage()
func (*SetReq) XXX_DiscardUnknown ¶
func (m *SetReq) XXX_DiscardUnknown()
func (*SetReq) XXX_Marshal ¶
func (*SetReq) XXX_Unmarshal ¶
type SetRes ¶
type SetRes struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SetRes) Descriptor ¶
func (*SetRes) ProtoMessage ¶
func (*SetRes) ProtoMessage()
func (*SetRes) XXX_DiscardUnknown ¶
func (m *SetRes) XXX_DiscardUnknown()
func (*SetRes) XXX_Marshal ¶
func (*SetRes) XXX_Unmarshal ¶
Click to show internal directories.
Click to hide internal directories.