mongo

package
v0.0.0-...-5cca3c0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2019 License: ISC Imports: 6 Imported by: 0

Documentation

Index

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

func NewSession(config *root.MongoConfig) (*Session, error)

NewSession creates a new session to mongoDB

func (*Session) Close

func (s *Session) Close()

Close closes a mongoDB session

func (*Session) Copy

func (s *Session) Copy() *mgo.Session

Copy returns a mongoDB session

func (*Session) DropDatabase

func (s *Session) DropDatabase(db string) error

DropDatabase drops a mongoDB database named {db}

Jump to

Keyboard shortcuts

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