Documentation ¶
Index ¶
- type ContactService
- func (cs *ContactService) AddContact(contact *root.Contact) error
- func (cs *ContactService) AddEmail(nick string, email string) error
- func (cs *ContactService) AddMobile(nick string, mobile string) error
- func (cs *ContactService) ChangeNick(oldNick string, newNick string) error
- func (cs *ContactService) DelEmail(nick string, email string) error
- func (cs *ContactService) DelMobile(nick string, mobile string) error
- func (cs *ContactService) DeleteContact(nick string) error
- func (cs *ContactService) GetContact(nick string) (root.Contact, error)
- func (cs *ContactService) GetContacts() ([]root.Contact, error)
- func (cs *ContactService) UpdateContact(nick string, contact *root.Contact) error
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContactService ¶
type ContactService struct {
// contains filtered or unexported fields
}
ContactService type definition
func NewContactService ¶
func NewContactService(session *mgo.Session, config *root.MongoConfig) *ContactService
NewContactService creates a contact service instance
func (*ContactService) AddContact ¶
func (cs *ContactService) AddContact(contact *root.Contact) error
AddContact adds a contact to the collection
func (*ContactService) AddEmail ¶
func (cs *ContactService) AddEmail(nick string, email string) error
AddEmail adds an email address to the contact identified by nick
func (*ContactService) AddMobile ¶
func (cs *ContactService) AddMobile(nick string, mobile string) error
AddMobile adds a mobile to the contact identified by nick
func (*ContactService) ChangeNick ¶
func (cs *ContactService) ChangeNick(oldNick string, newNick string) error
ChangeNick changes the nick of a contact identified by oldNick
func (*ContactService) DelEmail ¶
func (cs *ContactService) DelEmail(nick string, email string) error
DelEmail removes an email address from the contact identified by nick
func (*ContactService) DelMobile ¶
func (cs *ContactService) DelMobile(nick string, mobile string) error
DelMobile removes a mobile from the contact identified by nick
func (*ContactService) DeleteContact ¶
func (cs *ContactService) DeleteContact(nick string) error
DeleteContact removes a contact from the collection
func (*ContactService) GetContact ¶
func (cs *ContactService) GetContact(nick string) (root.Contact, error)
GetContact gets a contact according to its nick from the collection
func (*ContactService) GetContacts ¶
func (cs *ContactService) GetContacts() ([]root.Contact, error)
GetContacts returns all contacts from the collection
func (*ContactService) UpdateContact ¶
func (cs *ContactService) UpdateContact(nick string, contact *root.Contact) error
UpdateContact updates a contact
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session type definition
func NewSession ¶
NewSession creates a new session to mongoDB
func (*Session) DropDatabase ¶
DropDatabase drops a mongoDB database named {db}