mongo

package
v0.0.0-...-47ace37 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(url, db, collection string) (storage.Storer, error)

New makes and return a new adapter of type storage.Storer using a mongo driver

Types

type Adapter

type Adapter struct {
	event.Dispatcher
	// contains filtered or unexported fields
}

Adapter is the repository Adapter

func (*Adapter) Close

func (a *Adapter) Close()

Close is the method to explicitly call to close the session

func (*Adapter) Create

func (a *Adapter) Create(res *resource.Resource) error

Create is ...

func (*Adapter) Delete

func (a *Adapter) Delete(resType *core.ResourceType, id, version string) error

Delete is ...

func (*Adapter) DoGet

func (a *Adapter) DoGet(resType *core.ResourceType, id, version string, fields map[attr.Path]bool) (*resource.Resource, error)

DoGet is ... Does not emit any event. Is used internally to fetch referenced documents.

func (*Adapter) DoUpdate

func (a *Adapter) DoUpdate(resource *resource.Resource, id, version string) error

DoUpdate is the method that permforms update operations. Does not emit any event. Is used internally to perform update to referenced documents.

func (*Adapter) Find

func (a *Adapter) Find(resTypes []*core.ResourceType, filter filter.Filter) (storage.Querier, error)

Find is ...

func (*Adapter) Get

func (a *Adapter) Get(resType *core.ResourceType, id, version string, fields map[attr.Path]bool) (*resource.Resource, error)

Get is ...

func (*Adapter) Patch

func (a *Adapter) Patch(resType *core.ResourceType, id string, version string, op string, f interface{}, value interface{}) error

Patch is ...

func (*Adapter) Ping

func (a *Adapter) Ping() error

Ping ...

func (*Adapter) SetIndexes

func (a *Adapter) SetIndexes(keys [][]string) error

SetIndexes is ...

func (*Adapter) Update

func (a *Adapter) Update(resource *resource.Resource, id string, version string) error

Update is ...

type Driver

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

Driver repository adaptee

func CreateDriver

func CreateDriver(url, db, collection string) (*Driver, error)

CreateDriver factory

func (*Driver) Close

func (d *Driver) Close()

Close is the method to explicitly call to close the session

func (*Driver) Create

func (d *Driver) Create(doc *document) error

Create is the driver method for Create

func (*Driver) Delete

func (d *Driver) Delete(query bson.M) error

Delete is the driver method for Delete

func (*Driver) Find

func (d *Driver) Find(q bson.M) (*mgo.Query, func(), error)

Find is the driver method for Find

func (*Driver) Patch

func (d *Driver) Patch(id string, query, values bson.M) error

Patch is the driver method for Patch

func (*Driver) SetIndexes

func (d *Driver) SetIndexes(keys [][]string) (err error)

SetIndexes is ...

func (*Driver) Update

func (d *Driver) Update(query bson.M, doc *document) error

Update is the driver method for Update

type Iter

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

Iter is

func (*Iter) Close

func (it *Iter) Close()

Close kills the current iterator.

func (*Iter) Done

func (it *Iter) Done() bool

Done returns true only if a follow up Next call is guaranteed to return false.

func (*Iter) Next

func (it *Iter) Next() *resource.Resource

Next retrieves the next resource from the result set, blocking if necessary.

type Query

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

Query is

func (*Query) Close

func (res *Query) Close()

func (*Query) Count

func (res *Query) Count() (n int, err error)

Count is...

func (*Query) Fields

func (res *Query) Fields(fields map[attr.Path]bool) storage.Querier

Fields is

func (*Query) Iter

func (res *Query) Iter() storage.Iter

Iter executes the query and returns an iterator capable of going over all the results.

func (*Query) Limit

func (res *Query) Limit(n int) storage.Querier

Limit is

func (*Query) Skip

func (res *Query) Skip(index int) storage.Querier

Skip is

func (*Query) Sort

func (res *Query) Sort(by attr.Path, asc bool) storage.Querier

Sort is

type ResourceNotFoundError

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

ResourceNotFoundError is ...

func (ResourceNotFoundError) Error

func (r ResourceNotFoundError) Error() string

Jump to

Keyboard shortcuts

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