Documentation ¶
Index ¶
- Variables
- func PublishEmailEntry(publisher msg.MsgPublisher, ctx context.Context, spec EmailEntrySpec, ...) error
- func ServeSendMailSvc(server rpc.RPCServer, svcSpec *SendMailSvcSpec, svc SendMailSvc) (err error)
- func SubscribeEmailEntry(subscriber msg.MsgSubscriber, spec EmailEntrySpec, queue string, ...) error
- type Email
- func (*Email) Descriptor() ([]byte, []int)deprecated
- func (x *Email) GetContent() string
- func (x *Email) GetContentType() string
- func (x *Email) GetSubject() string
- func (x *Email) GetToAddr() string
- func (x *Email) GetToName() string
- func (*Email) ProtoMessage()
- func (x *Email) ProtoReflect() protoreflect.Message
- func (x *Email) Reset()
- func (x *Email) String() string
- type EmailEntries
- type EmailEntry
- func (*EmailEntry) Descriptor() ([]byte, []int)deprecated
- func (x *EmailEntry) GetCreatedAt() string
- func (x *EmailEntry) GetEmail() *Email
- func (x *EmailEntry) GetEndedAt() string
- func (x *EmailEntry) GetFailedReason() string
- func (x *EmailEntry) GetId() int64
- func (x *EmailEntry) GetStatus() EmailEntry_Status
- func (*EmailEntry) ProtoMessage()
- func (x *EmailEntry) ProtoReflect() protoreflect.Message
- func (x *EmailEntry) Reset()
- func (x *EmailEntry) String() string
- type EmailEntrySpec
- type EmailEntry_Status
- func (EmailEntry_Status) Descriptor() protoreflect.EnumDescriptor
- func (x EmailEntry_Status) Enum() *EmailEntry_Status
- func (EmailEntry_Status) EnumDescriptor() ([]byte, []int)deprecated
- func (x EmailEntry_Status) Number() protoreflect.EnumNumber
- func (x EmailEntry_Status) String() string
- func (EmailEntry_Status) Type() protoreflect.EnumType
- type SendMailSvc
- type SendMailSvcSpec
Constants ¶
This section is empty.
Variables ¶
var ( EmailEntry_Status_name = map[int32]string{ 0: "SENDING", 1: "SUCCESS", 2: "FAILED", } EmailEntry_Status_value = map[string]int32{ "SENDING": 0, "SUCCESS": 1, "FAILED": 2, } )
Enum value maps for EmailEntry_Status.
var File_pb_proto protoreflect.FileDescriptor
var ( // QueueSpec is the msg spec for publisher/subscriber. QueueSpec = EmailEntrySpec("sendmail.queue") )
var ( // SvcSpec is the service spec for rpc server/client. SvcSpec = NewSendMailSvcSpec("sendmail") )
Functions ¶
func PublishEmailEntry ¶
func PublishEmailEntry( publisher msg.MsgPublisher, ctx context.Context, spec EmailEntrySpec, msg *EmailEntry, ) error
PublishEmailEntry publish a EmailEntry message.
func ServeSendMailSvc ¶
func ServeSendMailSvc(server rpc.RPCServer, svcSpec *SendMailSvcSpec, svc SendMailSvc) (err error)
ServeSendMailSvc serves SendMailSvc service using a RPCServer.
func SubscribeEmailEntry ¶
func SubscribeEmailEntry( subscriber msg.MsgSubscriber, spec EmailEntrySpec, queue string, handler func(context.Context, *EmailEntry) error, opts ...interface{}) error
SubscribeEmailEntry subscribes to a EmailEntry topic.
Types ¶
type Email ¶
type Email struct { // To email address. ToAddr string `protobuf:"bytes,1,opt,name=to_addr,json=toAddr,proto3" json:"to_addr,omitempty"` // To name. ToName string `protobuf:"bytes,2,opt,name=to_name,json=toName,proto3" json:"to_name,omitempty"` // Subject of email. Subject string `protobuf:"bytes,10,opt,name=subject,proto3" json:"subject,omitempty"` // ContentType is the mime type of email content. (e.g. text/html) ContentType string `protobuf:"bytes,11,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` // Content is email content. Content string `protobuf:"bytes,12,opt,name=content,proto3" json:"content,omitempty"` // contains filtered or unexported fields }
func (*Email) Descriptor
deprecated
func (*Email) GetContent ¶
func (*Email) GetContentType ¶
func (*Email) GetSubject ¶
func (*Email) ProtoMessage ¶
func (*Email) ProtoMessage()
func (*Email) ProtoReflect ¶
func (x *Email) ProtoReflect() protoreflect.Message
type EmailEntries ¶
type EmailEntries struct { Entries []*EmailEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` // contains filtered or unexported fields }
func (*EmailEntries) Descriptor
deprecated
func (*EmailEntries) Descriptor() ([]byte, []int)
Deprecated: Use EmailEntries.ProtoReflect.Descriptor instead.
func (*EmailEntries) GetEntries ¶
func (x *EmailEntries) GetEntries() []*EmailEntry
func (*EmailEntries) ProtoMessage ¶
func (*EmailEntries) ProtoMessage()
func (*EmailEntries) ProtoReflect ¶
func (x *EmailEntries) ProtoReflect() protoreflect.Message
func (*EmailEntries) Reset ¶
func (x *EmailEntries) Reset()
func (*EmailEntries) String ¶
func (x *EmailEntries) String() string
type EmailEntry ¶
type EmailEntry struct { // Id is unique id of the email entry. Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Status EmailEntry_Status `protobuf:"varint,2,opt,name=status,proto3,enum=nproto.demo.sendmail.EmailEntry_Status" json:"status,omitempty"` // CreatedAt is the time creating. CreatedAt string `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // EndedAt is the time success/failed. EndedAt string `protobuf:"bytes,4,opt,name=ended_at,json=endedAt,proto3" json:"ended_at,omitempty"` // FailedReason is sending error when failed. FailedReason string `protobuf:"bytes,5,opt,name=failed_reason,json=failedReason,proto3" json:"failed_reason,omitempty"` // Email is the concrete content. Email *Email `protobuf:"bytes,6,opt,name=email,proto3" json:"email,omitempty"` // contains filtered or unexported fields }
@@npmsg@@
func (*EmailEntry) Descriptor
deprecated
func (*EmailEntry) Descriptor() ([]byte, []int)
Deprecated: Use EmailEntry.ProtoReflect.Descriptor instead.
func (*EmailEntry) GetCreatedAt ¶
func (x *EmailEntry) GetCreatedAt() string
func (*EmailEntry) GetEmail ¶
func (x *EmailEntry) GetEmail() *Email
func (*EmailEntry) GetEndedAt ¶
func (x *EmailEntry) GetEndedAt() string
func (*EmailEntry) GetFailedReason ¶
func (x *EmailEntry) GetFailedReason() string
func (*EmailEntry) GetId ¶
func (x *EmailEntry) GetId() int64
func (*EmailEntry) GetStatus ¶
func (x *EmailEntry) GetStatus() EmailEntry_Status
func (*EmailEntry) ProtoMessage ¶
func (*EmailEntry) ProtoMessage()
func (*EmailEntry) ProtoReflect ¶
func (x *EmailEntry) ProtoReflect() protoreflect.Message
func (*EmailEntry) Reset ¶
func (x *EmailEntry) Reset()
func (*EmailEntry) String ¶
func (x *EmailEntry) String() string
type EmailEntrySpec ¶
type EmailEntrySpec string
EmailEntrySpec implements msg.MsgSpec interface.
func (EmailEntrySpec) MsgType ¶
func (spec EmailEntrySpec) MsgType() reflect.Type
MsgType returns reflect.TypeOf((*EmailEntry)(nil)).
func (EmailEntrySpec) MsgValue ¶
func (spec EmailEntrySpec) MsgValue() interface{}
MsgValue returns a sample *EmailEntry.
func (EmailEntrySpec) NewMsg ¶
func (spec EmailEntrySpec) NewMsg() interface{}
NewMsg returns new(EmailEntry).
func (EmailEntrySpec) SubjectName ¶
func (spec EmailEntrySpec) SubjectName() string
SubjectName returns string(spec).
type EmailEntry_Status ¶
type EmailEntry_Status int32
Status indicates the sending status.
const ( EmailEntry_SENDING EmailEntry_Status = 0 EmailEntry_SUCCESS EmailEntry_Status = 1 EmailEntry_FAILED EmailEntry_Status = 2 )
func (EmailEntry_Status) Descriptor ¶
func (EmailEntry_Status) Descriptor() protoreflect.EnumDescriptor
func (EmailEntry_Status) Enum ¶
func (x EmailEntry_Status) Enum() *EmailEntry_Status
func (EmailEntry_Status) EnumDescriptor
deprecated
func (EmailEntry_Status) EnumDescriptor() ([]byte, []int)
Deprecated: Use EmailEntry_Status.Descriptor instead.
func (EmailEntry_Status) Number ¶
func (x EmailEntry_Status) Number() protoreflect.EnumNumber
func (EmailEntry_Status) String ¶
func (x EmailEntry_Status) String() string
func (EmailEntry_Status) Type ¶
func (EmailEntry_Status) Type() protoreflect.EnumType
type SendMailSvc ¶
type SendMailSvc interface { Send(context.Context, *Email) (*EmailEntry, error) List(context.Context, *empty.Empty) (*EmailEntries, error) }
@@nprpc@@
func InvokeSendMailSvc ¶
func InvokeSendMailSvc(client rpc.RPCClient, svcSpec *SendMailSvcSpec) SendMailSvc
InvokeSendMailSvc invokes SendMailSvc service using a RPCClient.
type SendMailSvcSpec ¶
type SendMailSvcSpec struct {
// contains filtered or unexported fields
}
SendMailSvcSpec contains method specs of service SendMailSvc.
func NewSendMailSvcSpec ¶
func NewSendMailSvcSpec(svcName string) *SendMailSvcSpec
NewSendMailSvcSpec creates a new SendMailSvcSpec.