Documentation ¶
Index ¶
- Constants
- func CountEmailDocumentByWhere(ctx context.Context, db *mongo.Database, where EmailDocumentWhere) (int64, error)
- func CountEmailRelationDocumentByWhere(ctx context.Context, db *mongo.Database, where EmailRelationDocumentWhere) (int64, error)
- func CountSMDocumentByWhere(ctx context.Context, db *mongo.Database, where SMDocumentWhere) (int64, error)
- func EmailDocumentCreateIndexes(ctx context.Context, db *mongo.Database) error
- func EmailRelationDocumentCreateIndexes(ctx context.Context, db *mongo.Database) error
- func IsErrDuplicateKey(err error) bool
- func IsErrNoDocuments(err error) bool
- func SMDocumentCreateIndexes(ctx context.Context, db *mongo.Database) error
- type EmailAttachment
- type EmailContentSubDocument
- type EmailDocument
- func EmailDocumentByEID(ctx context.Context, db *mongo.Database, eid string) (*EmailDocument, error)
- func EmailDocumentByIDs(ctx context.Context, db *mongo.Database, ids []primitive.ObjectID) ([]*EmailDocument, error)
- func EmailDocumentByWhere(ctx context.Context, db *mongo.Database, where EmailDocumentWhere) ([]*EmailDocument, error)
- type EmailDocumentWhere
- type EmailRelationDocument
- type EmailRelationDocumentWhere
- type SMDocument
- type SMDocumentWhere
Constants ¶
const ( // DefaultSMSDBName default db name of sms DefaultSMSDBName = "sms" // SMDocumentCollection the collection name of short message SMDocumentCollection = "sm" )
const ( // DefaultSESDBName default db name of ses DefaultSESDBName = "ses" // EmailDocumentCollection the collection name of email EmailDocumentCollection = "email" // DefaultLimit default limit DefaultLimit = 50 )
const (
// EmailRelationDocumentCollection the collection name of email relation
EmailRelationDocumentCollection = "email_relation"
)
Variables ¶
This section is empty.
Functions ¶
func CountEmailDocumentByWhere ¶
func CountEmailDocumentByWhere(ctx context.Context, db *mongo.Database, where EmailDocumentWhere) (int64, error)
CountEmailDocumentByWhere count email documents by condition from the db
func CountEmailRelationDocumentByWhere ¶
func CountEmailRelationDocumentByWhere(ctx context.Context, db *mongo.Database, where EmailRelationDocumentWhere) (int64, error)
CountEmailRelationDocumentByWhere gets email relation document by condition from the db
func CountSMDocumentByWhere ¶
func CountSMDocumentByWhere(ctx context.Context, db *mongo.Database, where SMDocumentWhere) (int64, error)
CountSMDocumentByWhere count short message documents by condition from the db
func EmailDocumentCreateIndexes ¶
EmailDocumentCreateIndexes create indexes to optimize the query.
func EmailRelationDocumentCreateIndexes ¶
EmailRelationDocumentCreateIndexes create indexes to optimize the query.
Types ¶
type EmailAttachment ¶
type EmailAttachment struct { Name string `bson:"name,omitempty"` URL string `bson:"url,omitempty"` }
EmailAttachment attachment in mail
type EmailContentSubDocument ¶
type EmailContentSubDocument struct { From string `bson:"from,omitempty"` To []string `bson:"to,omitempty"` Cc []string `bson:"cc,omitempty"` Bcc []string `bson:"bcc,omitempty"` Subject string `bson:"subject,omitempty"` HTML string `bson:"html,omitempty"` Text string `bson:"text,omitempty"` Attachments []EmailAttachment `bson:"attachments,omitempty"` }
EmailContentSubDocument storing sub documents for email
type EmailDocument ¶
type EmailDocument struct { ID primitive.ObjectID `bson:"_id,omitempty"` EID string `bson:"eid,omitempty"` ReID string `bson:"reid,omitempty"` SendDate time.Time `bson:"sendDate,omitempty"` Status string `bson:"status,omitempty"` Reason string `bson:"reason,omitempty"` Content EmailContentSubDocument `bson:"content,omitempty"` }
EmailDocument storing documents for email
func EmailDocumentByEID ¶
func EmailDocumentByEID(ctx context.Context, db *mongo.Database, eid string) (*EmailDocument, error)
EmailDocumentByEID gets a email document by eid from the db
func EmailDocumentByIDs ¶
func EmailDocumentByIDs(ctx context.Context, db *mongo.Database, ids []primitive.ObjectID) ([]*EmailDocument, error)
EmailDocumentByIDs gets list of email document by ids from the db
func EmailDocumentByWhere ¶
func EmailDocumentByWhere(ctx context.Context, db *mongo.Database, where EmailDocumentWhere) ([]*EmailDocument, error)
EmailDocumentByWhere gets pagination list of email document by condition from the db
func (*EmailDocument) Collection ¶
func (doc *EmailDocument) Collection() string
Collection return collection name
type EmailDocumentWhere ¶
type EmailDocumentWhere struct { StartTime time.Time EndTime time.Time From string To string Cc string Bcc string // pagination info Limit int64 Offset int64 LastID *primitive.ObjectID }
EmailDocumentWhere query condition
type EmailRelationDocument ¶
type EmailRelationDocument struct { ID primitive.ObjectID `bson:"_id,omitempty"` OID primitive.ObjectID `bson:"oid,omitempty"` EID string `bson:"eid,omitempty"` From string `bson:"from,omitempty"` To string `bson:"to,omitempty"` Tp string `bson:"tp,omitempty"` }
EmailRelationDocument storing to addr relation document for email
func EmailRelationDocumentByWhere ¶
func EmailRelationDocumentByWhere(ctx context.Context, db *mongo.Database, where EmailRelationDocumentWhere) ([]*EmailRelationDocument, error)
EmailRelationDocumentByWhere gets email relation document by condition from the db
func (*EmailRelationDocument) Collection ¶
func (doc *EmailRelationDocument) Collection() string
Collection return collection name
type EmailRelationDocumentWhere ¶
type EmailRelationDocumentWhere struct { From string To string Tp string // pagination info Limit int64 LastID *primitive.ObjectID }
EmailRelationDocumentWhere query condition
type SMDocument ¶
type SMDocument struct { ID primitive.ObjectID `bson:"_id,omitempty"` MID string `bson:"mid,omitempty"` OmID string `bson:"omid,omitempty"` SendDate time.Time `bson:"sendDate,omitempty"` Status string `bson:"status,omitempty"` Reason string `bson:"reason,omitempty"` Mobile string `bson:"mobile,omitempty"` Message string `bson:"message,omitempty"` }
SMDocument storing documents for short message
func SMDocumentByMID ¶
SMDocumentByMID gets a short message document by mid from the db
func SMDocumentByWhere ¶
func SMDocumentByWhere(ctx context.Context, db *mongo.Database, where SMDocumentWhere) ([]*SMDocument, error)
SMDocumentByWhere gets pagination list of short message document by condition from the db
func (*SMDocument) Collection ¶
func (doc *SMDocument) Collection() string
Collection return collection name