db

package
v0.0.0-...-7f5fdc3 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2016 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASSET      = "asset"
	PENDING    = "pending"
	PROCESSING = "processing"
	READY      = "ready"
	LOST       = "lost"
)

Variables

This section is empty.

Functions

func AlterDoc

func AlterDoc(doc *M, operator string, operation M)

func Convert

func Convert(doc M, out interface{})

func EpochHours

func EpochHours() int64

func EpochNow

func EpochNow() int64

func InArray

func InArray(key string, arrays ...[]string) bool

Types

type Asset

type Asset struct {
	History       []string
	Id            bson.ObjectId     `json:"_id,omitempty" bson:"_id",omitempty`
	Size          int64             `json:"size" bson:"size"`
	CreatedOn     int64             `json:"created_on" bson:"created_on"`
	Name          string            `json:"name" bson:"name"`
	FileType      string            `json:"file_type" bson:"file_type"`
	MimeType      string            `json:"mime_type" bson:"mime_type"`
	Bucket        string            `json:"bucket" bson:"bucket"`
	Path          string            `json:"path" bson:"path"`
	Collection    string            `json:"collection" bson:"collection"`
	ThumbnailPath string            `json:"thumbnail_path" bson:"thumbnail_path"`
	Status        string            `json:"status" bson:"status"`
	Thumbnails    map[string]string `json:"-" bson:"thumbnails"`
}

type M

type M bson.M

type MConn

type MConn struct {
	Session *mgo.Session
	Dbname  string
}
var Conn *MConn

func GetConn

func GetConn(connString, db_name string) *MConn

func (*MConn) Aggregate

func (self *MConn) Aggregate(session *mgo.Session, table string,
	doc []M) *mgo.Pipe

func (*MConn) Count

func (self *MConn) Count(table string, query M) int

func (*MConn) Delete

func (self *MConn) Delete(table string, query M) error

func (*MConn) DropIndex

func (self *MConn) DropIndex(table string, key ...string) error

func (*MConn) DropIndices

func (self *MConn) DropIndices(table string) error

func (*MConn) EnsureIndex

func (self *MConn) EnsureIndex(table string, index mgo.Index) error

func (*MConn) FindAndUpdate

func (self *MConn) FindAndUpdate(table string, query M,
	doc M, result interface{}) error

func (*MConn) FindAndUpsert

func (self *MConn) FindAndUpsert(table string, query M,
	doc M, result interface{}) error

func (*MConn) Get

func (self *MConn) Get(session *mgo.Session, table string,
	query M) *mgo.Iter

func (*MConn) GetCursor

func (self *MConn) GetCursor(session *mgo.Session, table string,
	query M) *mgo.Query

func (*MConn) GetOne

func (self *MConn) GetOne(table string, query M,
	result interface{}) error

func (*MConn) HintedCount

func (self *MConn) HintedCount(table string, query M, hint string) int

func (*MConn) HintedGetOne

func (self *MConn) HintedGetOne(table string, query M,
	result interface{}, hint string) error

func (*MConn) Insert

func (self *MConn) Insert(table string, doc interface{})

func (*MConn) MapReduce

func (self *MConn) MapReduce(session *mgo.Session, table string,
	query M, result interface{}, job *MapReduce) (*mgo.MapReduceInfo, error)

func (*MConn) Update

func (self *MConn) Update(table string, query M, doc M) error

func (*MConn) Upsert

func (self *MConn) Upsert(table string, query M, doc M) error

type MapReduce

type MapReduce mgo.MapReduce

Jump to

Keyboard shortcuts

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