Documentation ¶
Index ¶
- Variables
- type Address
- func (*Address) Descriptor() ([]byte, []int)deprecated
- func (x *Address) GetCity() string
- func (x *Address) GetState() string
- func (x *Address) GetStreet() string
- func (x *Address) GetZipCode() string
- func (*Address) ProtoMessage()
- func (x *Address) ProtoReflect() protoreflect.Message
- func (x *Address) Reset()
- func (x *Address) String() string
- type CancelledState
- type CompletedState
- type Delivery
- func (*Delivery) Descriptor() ([]byte, []int)deprecated
- func (x *Delivery) GetAddress() *Address
- func (x *Delivery) GetCreatedAt() *timestamppb.Timestamp
- func (x *Delivery) GetDeliveryAt() *timestamppb.Timestamp
- func (x *Delivery) GetDriverId() string
- func (x *Delivery) GetID() string
- func (x *Delivery) GetId() string
- func (x *Delivery) GetOrderId() string
- func (x *Delivery) GetPickupAt() *timestamppb.Timestamp
- func (x *Delivery) GetStatus() DeliveryStatus
- func (x *Delivery) GetUpdatedAt() *timestamppb.Timestamp
- func (x *Delivery) GetUserId() string
- func (x *Delivery) MarshalBSON() ([]byte, error)
- func (x *Delivery) Next(ctx contextx.Contextx) (event *DeliveryEvent, err error)
- func (*Delivery) ProtoMessage()
- func (x *Delivery) ProtoReflect() protoreflect.Message
- func (x *Delivery) Reset()
- func (x *Delivery) SetCreatedAt(t *timestamppb.Timestamp)
- func (x *Delivery) SetID(id primitive.ObjectID)
- func (x *Delivery) SetUpdatedAt(t *timestamppb.Timestamp)
- func (x *Delivery) String() string
- func (x *Delivery) UnmarshalBSON(bytes []byte) error
- type DeliveryEvent
- type DeliveryState
- type DeliveryStatus
- func (DeliveryStatus) Descriptor() protoreflect.EnumDescriptor
- func (x DeliveryStatus) Enum() *DeliveryStatus
- func (DeliveryStatus) EnumDescriptor() ([]byte, []int)deprecated
- func (x DeliveryStatus) Number() protoreflect.EnumNumber
- func (x DeliveryStatus) String() string
- func (DeliveryStatus) Type() protoreflect.EnumType
- type InTransitState
- type PendingState
- type PickedUpState
Constants ¶
This section is empty.
Variables ¶
var ( DeliveryStatus_name = map[int32]string{ 0: "DELIVERY_STATUS_UNSPECIFIED", 1: "DELIVERY_STATUS_PENDING", 2: "DELIVERY_STATUS_IN_TRANSIT", 3: "DELIVERY_STATUS_DELIVERED", } DeliveryStatus_value = map[string]int32{ "DELIVERY_STATUS_UNSPECIFIED": 0, "DELIVERY_STATUS_PENDING": 1, "DELIVERY_STATUS_IN_TRANSIT": 2, "DELIVERY_STATUS_DELIVERED": 3, } )
Enum value maps for DeliveryStatus.
var File_domain_logistics_model_logistics_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { // Street is the street address of the user. // @gotags: bson:"street" Street string `protobuf:"bytes,1,opt,name=street,proto3" json:"street,omitempty" bson:"street"` // City is the city where the user is located. // @gotags: bson:"city" City string `protobuf:"bytes,2,opt,name=city,proto3" json:"city,omitempty" bson:"city"` // State is the state where the user is located. // @gotags: bson:"state" State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty" bson:"state"` // ZipCode is the postal code of the user's location. // @gotags: bson:"zip_code" ZipCode string `protobuf:"bytes,4,opt,name=zip_code,json=zipCode,proto3" json:"zip_code,omitempty" bson:"zip_code"` // contains filtered or unexported fields }
Address is a value object that represents the address of a user.
func (*Address) Descriptor
deprecated
func (*Address) GetZipCode ¶
func (*Address) ProtoMessage ¶
func (*Address) ProtoMessage()
func (*Address) ProtoReflect ¶
func (x *Address) ProtoReflect() protoreflect.Message
type CancelledState ¶
type CancelledState struct{}
CancelledState represents the cancelled state of a delivery.
func (*CancelledState) Next ¶
func (s *CancelledState) Next(ctx contextx.Contextx, delivery *Delivery) (event *DeliveryEvent, err error)
func (*CancelledState) String ¶
func (s *CancelledState) String() string
type CompletedState ¶
type CompletedState struct{}
CompletedState represents the completed state of a delivery.
func (*CompletedState) Next ¶
func (s *CompletedState) Next(ctx contextx.Contextx, delivery *Delivery) (event *DeliveryEvent, err error)
func (*CompletedState) String ¶
func (s *CompletedState) String() string
type Delivery ¶
type Delivery struct { // ID is the unique identifier of the delivery. // @gotags: bson:"_id,omitempty" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" bson:"_id,omitempty"` // OrderID is the identifier of the order associated with the delivery. // @gotags: bson:"order_id" OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty" bson:"order_id"` // UserID is the identifier of the user who placed the order. // @gotags: bson:"user_id" UserId string `protobuf:"bytes,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty" bson:"user_id"` // Address is the address where the delivery is to be made. // @gotags: bson:"address" Address *Address `protobuf:"bytes,10,opt,name=address,proto3" json:"address,omitempty" bson:"address"` // DriverID is the identifier of the driver assigned to the delivery. // @gotags: bson:"driver_id" DriverId string `protobuf:"bytes,4,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty" bson:"driver_id"` // Status is the current status of the delivery (e.g., pending, in transit, delivered). // @gotags: bson:"status" Status DeliveryStatus `protobuf:"varint,5,opt,name=status,proto3,enum=logistics.DeliveryStatus" json:"status,omitempty" bson:"status"` // PickupAt is the timestamp when the delivery was picked up. // @gotags: bson:"pickup_at" PickupAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=pickup_at,json=pickupAt,proto3" json:"pickup_at,omitempty" bson:"pickup_at"` // DeliveryAt is the timestamp when the delivery is expected to be delivered. // @gotags: bson:"delivery_at" DeliveryAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=delivery_at,json=deliveryAt,proto3" json:"delivery_at,omitempty" bson:"delivery_at"` // CreatedAt is the timestamp when the delivery was created. // @gotags: bson:"created_at" CreatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty" bson:"created_at"` // UpdatedAt is the timestamp when the delivery was last updated. // @gotags: bson:"updated_at" UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty" bson:"updated_at"` // contains filtered or unexported fields }
Delivery is an entity that represents a delivery.
func NewDelivery ¶
NewDelivery creates a new delivery entity.
func (*Delivery) Descriptor
deprecated
func (*Delivery) GetAddress ¶
func (*Delivery) GetCreatedAt ¶
func (x *Delivery) GetCreatedAt() *timestamppb.Timestamp
func (*Delivery) GetDeliveryAt ¶
func (x *Delivery) GetDeliveryAt() *timestamppb.Timestamp
func (*Delivery) GetDriverId ¶
func (*Delivery) GetOrderId ¶
func (*Delivery) GetPickupAt ¶
func (x *Delivery) GetPickupAt() *timestamppb.Timestamp
func (*Delivery) GetStatus ¶
func (x *Delivery) GetStatus() DeliveryStatus
func (*Delivery) GetUpdatedAt ¶
func (x *Delivery) GetUpdatedAt() *timestamppb.Timestamp
func (*Delivery) MarshalBSON ¶
func (*Delivery) Next ¶
func (x *Delivery) Next(ctx contextx.Contextx) (event *DeliveryEvent, err error)
Next returns the next delivery event.
func (*Delivery) ProtoMessage ¶
func (*Delivery) ProtoMessage()
func (*Delivery) ProtoReflect ¶
func (x *Delivery) ProtoReflect() protoreflect.Message
func (*Delivery) SetCreatedAt ¶
func (x *Delivery) SetCreatedAt(t *timestamppb.Timestamp)
func (*Delivery) SetUpdatedAt ¶
func (x *Delivery) SetUpdatedAt(t *timestamppb.Timestamp)
func (*Delivery) UnmarshalBSON ¶
type DeliveryEvent ¶
type DeliveryEvent struct { Name string `json:"name,omitempty"` Handler string `json:"handler,omitempty"` Data *Delivery `json:"data,omitempty"` }
DeliveryEvent represents an event during the delivery state transition.
func (*DeliveryEvent) Key ¶
func (x *DeliveryEvent) Key() []byte
func (*DeliveryEvent) OccurredOn ¶
func (x *DeliveryEvent) OccurredOn(ctx contextx.Contextx) time.Time
func (*DeliveryEvent) Topic ¶
func (x *DeliveryEvent) Topic() string
func (*DeliveryEvent) Value ¶
func (x *DeliveryEvent) Value() ([]byte, error)
type DeliveryState ¶
type DeliveryState interface { fmt.Stringer Next(ctx contextx.Contextx, delivery *Delivery) (event *DeliveryEvent, err error) }
DeliveryState interface defines the behavior of different delivery states.
func UnmarshalDeliveryState ¶
func UnmarshalDeliveryState(raw string) (DeliveryState, error)
UnmarshalDeliveryState unmarshals the raw string into a delivery state.
type DeliveryStatus ¶
type DeliveryStatus int32
DeliveryState is an enum that represents the state of a delivery.
const ( DeliveryStatus_DELIVERY_STATUS_UNSPECIFIED DeliveryStatus = 0 DeliveryStatus_DELIVERY_STATUS_PENDING DeliveryStatus = 1 DeliveryStatus_DELIVERY_STATUS_IN_TRANSIT DeliveryStatus = 2 DeliveryStatus_DELIVERY_STATUS_DELIVERED DeliveryStatus = 3 )
func (DeliveryStatus) Descriptor ¶
func (DeliveryStatus) Descriptor() protoreflect.EnumDescriptor
func (DeliveryStatus) Enum ¶
func (x DeliveryStatus) Enum() *DeliveryStatus
func (DeliveryStatus) EnumDescriptor
deprecated
func (DeliveryStatus) EnumDescriptor() ([]byte, []int)
Deprecated: Use DeliveryStatus.Descriptor instead.
func (DeliveryStatus) Number ¶
func (x DeliveryStatus) Number() protoreflect.EnumNumber
func (DeliveryStatus) String ¶
func (x DeliveryStatus) String() string
func (DeliveryStatus) Type ¶
func (DeliveryStatus) Type() protoreflect.EnumType
type InTransitState ¶
type InTransitState struct{}
InTransitState represents the in-transit state of a delivery.
func (*InTransitState) Next ¶
func (s *InTransitState) Next(ctx contextx.Contextx, delivery *Delivery) (event *DeliveryEvent, err error)
func (*InTransitState) String ¶
func (s *InTransitState) String() string
type PendingState ¶
type PendingState struct{}
PendingState represents the pending state of a delivery.
func (*PendingState) Next ¶
func (s *PendingState) Next(ctx contextx.Contextx, delivery *Delivery) (event *DeliveryEvent, err error)
func (*PendingState) String ¶
func (s *PendingState) String() string
type PickedUpState ¶
type PickedUpState struct{}
PickedUpState represents the picked-up state of a delivery.
func (*PickedUpState) Next ¶
func (s *PickedUpState) Next(ctx contextx.Contextx, delivery *Delivery) (event *DeliveryEvent, err error)
func (*PickedUpState) String ¶
func (s *PickedUpState) String() string