mongo

package
v0.0.0-...-2f581d8 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

type Mongo struct {
	IdentityCollection string // TODO need to make this identityCollection and tokenCollection
	TokenCollection    string // TODO need to make this identityCollection and tokenCollection
	Database           string
	Session            *mgo.Session
	URI                string
	// contains filtered or unexported fields
}

Mongo represents a simplistic MongoDB configuration.

func New

func New(cfg config.MongoConfig) (*Mongo, error)

func (*Mongo) GetIdentity

func (m *Mongo) GetIdentity(email string) (schema.Identity, error)

func (*Mongo) GetIdentityByID

func (m *Mongo) GetIdentityByID(ctx context.Context, id string) (*schema.Identity, error)

func (*Mongo) GetIdentityByToken

func (m *Mongo) GetIdentityByToken(ctx context.Context, token string) (*schema.Identity, *schema.Token, error)

func (*Mongo) SaveIdentity

func (m *Mongo) SaveIdentity(identity schema.Identity) (string, error)

func (*Mongo) StoreToken

func (m *Mongo) StoreToken(ctx context.Context, tkn schema.Token, i schema.Identity) error

StoreToken store a new token document in mongodb tokens collection. Any active token associated with the identity will be marked as deleted. Sets the last modified date on all documents updated.

Jump to

Keyboard shortcuts

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