mongodb

package
v0.0.0-...-5444539 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHexID = errors.New("Invalid Id Hex")
)

Functions

This section is empty.

Types

type Mongo

type Mongo struct {
	// contains filtered or unexported fields
}

func (*Mongo) CreateAddress

func (m *Mongo) CreateAddress(a *users.Address, userid string) error

func (*Mongo) CreateCard

func (m *Mongo) CreateCard(ca *users.Card, userid string) error

func (*Mongo) CreateUser

func (m *Mongo) CreateUser(u *users.User) error

func (*Mongo) Delete

func (m *Mongo) Delete(entity, id string) error

func (*Mongo) FindallUsers

func (m *Mongo) FindallUsers() ([]MongoUser, error)

func (*Mongo) Findallkeys

func (m *Mongo) Findallkeys(prefix string) []string

func (*Mongo) GetAddress

func (m *Mongo) GetAddress(id string) (users.Address, error)

func (*Mongo) GetAddresses

func (m *Mongo) GetAddresses() ([]users.Address, error)

func (*Mongo) GetCard

func (m *Mongo) GetCard(id string) (users.Card, error)

func (*Mongo) GetCards

func (m *Mongo) GetCards() ([]users.Card, error)

func (*Mongo) GetUser

func (m *Mongo) GetUser(id string) (users.User, error)

func (*Mongo) GetUserAttributes

func (m *Mongo) GetUserAttributes(u *users.User) error

func (*Mongo) GetUserByName

func (m *Mongo) GetUserByName(name string) (users.User, error)

func (*Mongo) GetUsers

func (m *Mongo) GetUsers() ([]users.User, error)

func (*Mongo) Init

func (m *Mongo) Init() error

func (*Mongo) Ping

func (m *Mongo) Ping() error

type MongoAddress

type MongoAddress struct {
	users.Address `bson:",inline"`
	ID            bson.ObjectId `bson:"_id"`
}

func (*MongoAddress) AddID

func (m *MongoAddress) AddID()

AddID ObjectID as string

type MongoCard

type MongoCard struct {
	users.Card `bson:",inline"`
	ID         bson.ObjectId `bson:"_id"`
}

MongoCard is a wrapper for Card

func (*MongoCard) AddID

func (m *MongoCard) AddID()

AddID ObjectID as string

type MongoUser

type MongoUser struct {
	users.User `bson:",inline"`
	ID         bson.ObjectId   `bson:"_id"`
	AddressIDs []bson.ObjectId `bson:"addresses"`
	CardIDs    []bson.ObjectId `bson:"cards"`
}

func New

func New() MongoUser

func (*MongoUser) AddUserIDs

func (mu *MongoUser) AddUserIDs()

Jump to

Keyboard shortcuts

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