db

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SMS   = "Sms"
	EMAIL = "Email"
	FAKE  = "Fake"
)

Variables

View Source
var TypeDb = GetDriver()

Functions

This section is empty.

Types

type Database

type Database interface {
	Insert(TemplateDB) error
	FindAll() ([]TemplateDB, error)
	Find(ID string) (TemplateDB, error)
	Remove(ID string) bool
}

func GetDriver

func GetDriver() Database

type Event

type Event struct {
	AccountID    string            `json:"AccountId"`
	Subject      string            `json:"Subject"`
	Channel      map[string]bool   `json:"Channel"`
	Lang         string            `json:"Language"`
	Recipient    []string          `json:"Recipient"`
	CustomData   map[string]string `json:"CustomData"`
	TemplateType string            `json:"TemplateType"`
	DateCreated  time.Time         `json:"dateCreated"`
}

Event struct

type Fake

type Fake struct{}

Fake struct

func (*Fake) Find

func (f *Fake) Find(id string) (TemplateDB, error)

func (*Fake) FindAll

func (f *Fake) FindAll() ([]TemplateDB, error)

func (*Fake) Insert

func (f *Fake) Insert(t TemplateDB) error

func (*Fake) Remove

func (f *Fake) Remove(id string) bool

type Message

type Message struct {
	MessageID       string            `json:"messageId,omitempty"`
	Channel         string            `json:"channel,omitempty"`
	TemplateId      string            `json:"templateId,omitempty"`
	CustomData      map[string]string `json:"customData,omitempty"`
	Subject         string            `json:"subject,omitempty"`
	Content         string            `json:"content,omitempty"`
	Recipient       string            `json:"recipient,omitempty"`
	FileAttached    string            `json:"fileAttached,omitempty"`
	MessageResponse MessageResponse   `json:"messageResponse,omitempty"`
	DateCreated     time.Time         `json:"dateCreated,omitempty"`
}

Message struct

type MessageResponse

type MessageResponse struct {
	Response       string    `json:"response,omitempty"`
	Status         string    `json:"status,omitempty"`
	APIStatus      string    `json:"apiStatus,omitempty"`
	TimeOfResponse time.Time `json:"timeOfResponse,omitempty"`
}

MessageResponse struct

type MongoDB

type MongoDB struct{}

func (MongoDB) Find

func (m MongoDB) Find(ID string) (TemplateDB, error)

func (MongoDB) FindAll

func (m MongoDB) FindAll() ([]TemplateDB, error)

func (MongoDB) Insert

func (m MongoDB) Insert(template TemplateDB) error

func (MongoDB) Remove

func (m MongoDB) Remove(ID string) bool

type Template

type Template struct {
	TemplateId string `bson:"_id" json:"TemplateId"`
	Channel    string `bson:"Channel" json:"Channel"`
	Language   string `bson:"Lang" json:"Lang"`
	Content    string `bson:"Content" json:"Content"`
}

Template struct

type TemplateDB

type TemplateDB struct {
	Template string `bson:"_id"` //This will be templateId + channel + lang
	Content  string `bson:"Content"`
}

Jump to

Keyboard shortcuts

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