mongodb

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//2200.01.01.00 as a forever ttl
	TTLForever = time.Date(2200, time.Month(1), 1, 0, 0, 0, 0, time.UTC)
)

Functions

func Condition

func Condition(meta *client.RequestMeta, condition *client.QueryMetaData, p storage.SelectionPredicate) error

func New

func New(sess *mgo.Session, dbName string, codec runtime.Codec) *store

New create a mongo store

Types

type APIObjectVersioner

type APIObjectVersioner struct{}

APIObjectVersioner implements versioning and extracting database information for objects that have an embedded ObjectMeta or ListMeta field.

func (APIObjectVersioner) ObjectResourceVersion

func (a APIObjectVersioner) ObjectResourceVersion(obj runtime.Object) (uint64, error)

ObjectResourceVersion implements Versioner

func (APIObjectVersioner) UpdateList

func (a APIObjectVersioner) UpdateList(obj runtime.Object, resourceVersion uint64) error

UpdateList implements Versioner

func (APIObjectVersioner) UpdateObject

func (a APIObjectVersioner) UpdateObject(obj runtime.Object, resourceVersion uint64) error

UpdateObject implements Versioner

type Collection

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

func GetCollection

func GetCollection(dbName string, sess *mgo.Session, obj runtime.Object) (*Collection, error)

func (*Collection) CreateIndex

func (c *Collection) CreateIndex(meta *client.RequestMeta) error

CreateIndex by runtime object

func (*Collection) GetRequestMeta

func (c *Collection) GetRequestMeta(sess *mgo.Session) *client.RequestMeta

type DocObject

type DocObject struct {
	TTL    time.Time `bson:"ttl"`
	UID    types.UID `bson:"uid"`
	Key    string    `bson:"key"`
	Object []byte    `bson:"obj"`
}

type Document

type Document struct {
	TTL    time.Time
	Object runtime.Object
}

func NewDocument

func NewDocument(ttl uint64, obj runtime.Object) *Document

func (*Document) Decode

func (doc *Document) Decode(codec runtime.Codec) (interface{}, error)

func (*Document) Encode

func (doc *Document) Encode(codec runtime.Codec, key string) (interface{}, error)

Jump to

Keyboard shortcuts

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