catalog

package
v0.0.0-...-551f129 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceName = "catalog"
)

Variables

This section is empty.

Functions

func NewCatalogEndpoints

func NewCatalogEndpoints() []*api.Endpoint

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

func (c *Catalog) Delete(ctx context.Context, req *DeleteReq, res *DeleteRes) error

func (*Catalog) FindByID

func (c *Catalog) FindByID(ctx context.Context, req *FindByIDReq, res *FindByIDRes) error

func (*Catalog) Init

func (c *Catalog) Init(sqlDB *bun.DB)

func (*Catalog) List

func (c *Catalog) List(ctx context.Context, req *ListReq, res *ListRes) error

func (*Catalog) Set

func (c *Catalog) Set(ctx context.Context, req *SetReq, res *SetRes) error

type CatalogHandler

type CatalogHandler interface {
	// 列出所有的产品
	List(context.Context, *ListReq, *ListRes) error
	// 增加或者更新产品信息
	Set(context.Context, *SetReq, *SetRes) error
	// 删除产品
	Delete(context.Context, *DeleteReq, *DeleteRes) error
	// 根据产品 ID 查询
	FindByID(context.Context, *FindByIDReq, *FindByIDRes) error
}

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) Descriptor() ([]byte, []int)

func (*DeleteReq) GetProductId

func (m *DeleteReq) GetProductId() string

func (*DeleteReq) ProtoMessage

func (*DeleteReq) ProtoMessage()

func (*DeleteReq) Reset

func (m *DeleteReq) Reset()

func (*DeleteReq) String

func (m *DeleteReq) String() string

func (*DeleteReq) XXX_DiscardUnknown

func (m *DeleteReq) XXX_DiscardUnknown()

func (*DeleteReq) XXX_Marshal

func (m *DeleteReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteReq) XXX_Merge

func (m *DeleteReq) XXX_Merge(src proto.Message)

func (*DeleteReq) XXX_Size

func (m *DeleteReq) XXX_Size() int

func (*DeleteReq) XXX_Unmarshal

func (m *DeleteReq) XXX_Unmarshal(b []byte) error

type DeleteRes

type DeleteRes struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteRes) Descriptor

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

func (*DeleteRes) ProtoMessage

func (*DeleteRes) ProtoMessage()

func (*DeleteRes) Reset

func (m *DeleteRes) Reset()

func (*DeleteRes) String

func (m *DeleteRes) String() string

func (*DeleteRes) XXX_DiscardUnknown

func (m *DeleteRes) XXX_DiscardUnknown()

func (*DeleteRes) XXX_Marshal

func (m *DeleteRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteRes) XXX_Merge

func (m *DeleteRes) XXX_Merge(src proto.Message)

func (*DeleteRes) XXX_Size

func (m *DeleteRes) XXX_Size() int

func (*DeleteRes) XXX_Unmarshal

func (m *DeleteRes) XXX_Unmarshal(b []byte) error

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) Descriptor() ([]byte, []int)

func (*ListReq) ProtoMessage

func (*ListReq) ProtoMessage()

func (*ListReq) Reset

func (m *ListReq) Reset()

func (*ListReq) String

func (m *ListReq) String() string

func (*ListReq) XXX_DiscardUnknown

func (m *ListReq) XXX_DiscardUnknown()

func (*ListReq) XXX_Marshal

func (m *ListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListReq) XXX_Merge

func (m *ListReq) XXX_Merge(src proto.Message)

func (*ListReq) XXX_Size

func (m *ListReq) XXX_Size() int

func (*ListReq) XXX_Unmarshal

func (m *ListReq) XXX_Unmarshal(b []byte) error

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) Descriptor() ([]byte, []int)

func (*ListRes) GetProducts

func (m *ListRes) GetProducts() []*Product

func (*ListRes) ProtoMessage

func (*ListRes) ProtoMessage()

func (*ListRes) Reset

func (m *ListRes) Reset()

func (*ListRes) String

func (m *ListRes) String() string

func (*ListRes) XXX_DiscardUnknown

func (m *ListRes) XXX_DiscardUnknown()

func (*ListRes) XXX_Marshal

func (m *ListRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListRes) XXX_Merge

func (m *ListRes) XXX_Merge(src proto.Message)

func (*ListRes) XXX_Size

func (m *ListRes) XXX_Size() int

func (*ListRes) XXX_Unmarshal

func (m *ListRes) XXX_Unmarshal(b []byte) error

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

func (p *Prod) AfterCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

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) Descriptor() ([]byte, []int)

func (*Product) GetCreatedAt

func (m *Product) GetCreatedAt() int64

func (*Product) GetDeletedAt

func (m *Product) GetDeletedAt() int64

func (*Product) GetId

func (m *Product) GetId() string

func (*Product) GetName

func (m *Product) GetName() string

func (*Product) GetOperator

func (m *Product) GetOperator() string

func (*Product) GetPriceCent

func (m *Product) GetPriceCent() int32

func (*Product) GetSnapshot

func (m *Product) GetSnapshot() uint64

func (*Product) GetUpdatedAt

func (m *Product) GetUpdatedAt() int64

func (*Product) ProtoMessage

func (*Product) ProtoMessage()

func (*Product) Reset

func (m *Product) Reset()

func (*Product) String

func (m *Product) String() string

func (*Product) XXX_DiscardUnknown

func (m *Product) XXX_DiscardUnknown()

func (*Product) XXX_Marshal

func (m *Product) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Product) XXX_Merge

func (m *Product) XXX_Merge(src proto.Message)

func (*Product) XXX_Size

func (m *Product) XXX_Size() int

func (*Product) XXX_Unmarshal

func (m *Product) XXX_Unmarshal(b []byte) error

type Server

type Server struct {
	Namespace      string   `json:"namespace"`
	Production     bool     `json:"production"`
	LogOutputPaths []string `json:"logging_output_paths"`
}

func NewServer

func NewServer() *Server

func (*Server) Name

func (s *Server) Name() string

func (*Server) Run

func (s *Server) Run()

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) Descriptor() ([]byte, []int)

func (*SetReq) GetProduct

func (m *SetReq) GetProduct() *Product

func (*SetReq) ProtoMessage

func (*SetReq) ProtoMessage()

func (*SetReq) Reset

func (m *SetReq) Reset()

func (*SetReq) String

func (m *SetReq) String() string

func (*SetReq) XXX_DiscardUnknown

func (m *SetReq) XXX_DiscardUnknown()

func (*SetReq) XXX_Marshal

func (m *SetReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SetReq) XXX_Merge

func (m *SetReq) XXX_Merge(src proto.Message)

func (*SetReq) XXX_Size

func (m *SetReq) XXX_Size() int

func (*SetReq) XXX_Unmarshal

func (m *SetReq) XXX_Unmarshal(b []byte) error

type SetRes

type SetRes struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SetRes) Descriptor

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

func (*SetRes) ProtoMessage

func (*SetRes) ProtoMessage()

func (*SetRes) Reset

func (m *SetRes) Reset()

func (*SetRes) String

func (m *SetRes) String() string

func (*SetRes) XXX_DiscardUnknown

func (m *SetRes) XXX_DiscardUnknown()

func (*SetRes) XXX_Marshal

func (m *SetRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SetRes) XXX_Merge

func (m *SetRes) XXX_Merge(src proto.Message)

func (*SetRes) XXX_Size

func (m *SetRes) XXX_Size() int

func (*SetRes) XXX_Unmarshal

func (m *SetRes) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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