example

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Schema = schema{
	AnotherModel: &schemaAnotherModel{
		Foo: storable.NewField("foo", "float64"),
		Bar: storable.NewField("bar", "string"),
	},
	MyModel: &schemaMyModel{
		String:     storable.NewField("string", "string"),
		Int:        storable.NewField("bla2", "int"),
		Slice:      storable.NewField("slice", "string"),
		SliceAlias: storable.NewField("slicealias", "string"),
		NestedRef: &schemaMyModelNestedRef{
			X: storable.NewField("nestedref.x", "int"),
			Y: storable.NewField("nestedref.y", "int"),
			Another: &schemaMyModelNestedRefAnother{
				X: storable.NewField("nestedref.another.x", "int"),
				Y: storable.NewField("nestedref.another.y", "int"),
			},
		},
		Nested: &schemaMyModelNested{
			X: storable.NewField("nested.x", "int"),
			Y: storable.NewField("nested.y", "int"),
			Another: &schemaMyModelNestedAnother{
				X: storable.NewField("nested.another.x", "int"),
				Y: storable.NewField("nested.another.y", "int"),
			},
		},
		NestedSlice: &schemaMyModelNestedSlice{
			X: storable.NewField("nestedslice.x", "int"),
			Y: storable.NewField("nestedslice.y", "int"),
			Another: &schemaMyModelNestedSliceAnother{
				X: storable.NewField("nestedslice.another.x", "int"),
				Y: storable.NewField("nestedslice.another.y", "int"),
			},
		},
		AliasOfString: storable.NewField("aliasofstring", "string"),
		Time:          storable.NewField("time", "time.Time"),
		MapsOfString:  storable.NewMap("mapsofstring.[map]", "string"),
		InlineStruct: &schemaMyModelInlineStruct{
			MapOfString: storable.NewMap("inlinestruct.mapofstring.[map]", "string"),
			MapOfSomeType: &schemaMyModelInlineStructMapOfSomeType{
				X: storable.NewMap("inlinestruct.mapofsometype.[map].x", "int"),
				Y: storable.NewMap("inlinestruct.mapofsometype.[map].y", "int"),
				Another: &schemaMyModelInlineStructMapOfSomeTypeAnother{
					X: storable.NewMap("inlinestruct.mapofsometype.[map].another.x", "int"),
					Y: storable.NewMap("inlinestruct.mapofsometype.[map].another.y", "int"),
				},
			},
		},
	},
}

Functions

This section is empty.

Types

type Alias added in v0.2.0

type Alias string

type AnotherModel added in v0.2.0

type AnotherModel struct {
	storable.Document `bson:",inline" collection:"another_model"`
	Foo               float64
	Bar               string
}

func NewAnotherModel added in v0.2.0

func NewAnotherModel() *AnotherModel

type AnotherModelQuery added in v0.2.0

type AnotherModelQuery struct {
	storable.BaseQuery
}

func (*AnotherModelQuery) FindById added in v0.2.0

func (q *AnotherModelQuery) FindById(ids ...bson.ObjectId)

type AnotherModelResultSet added in v0.2.0

type AnotherModelResultSet struct {
	storable.ResultSet
}

func (*AnotherModelResultSet) All added in v0.2.0

func (r *AnotherModelResultSet) All() ([]*AnotherModel, error)

func (*AnotherModelResultSet) Next added in v0.2.0

func (*AnotherModelResultSet) One added in v0.2.0

type AnotherModelStore added in v0.2.0

type AnotherModelStore struct {
	storable.Store
	Foo bool
}

func NewAnotherModelStore added in v0.2.0

func NewAnotherModelStore(db *mgo.Database, foo bool) *AnotherModelStore

func (*AnotherModelStore) Find added in v0.2.0

func (*AnotherModelStore) FindOne added in v0.2.0

func (s *AnotherModelStore) FindOne(query *AnotherModelQuery) (*AnotherModel, error)

func (*AnotherModelStore) Insert added in v0.2.0

func (s *AnotherModelStore) Insert(doc *AnotherModel) error

func (*AnotherModelStore) MustFind added in v0.2.0

func (*AnotherModelStore) MustFindOne added in v0.2.0

func (s *AnotherModelStore) MustFindOne(query *AnotherModelQuery) *AnotherModel

func (*AnotherModelStore) New added in v0.2.0

func (s *AnotherModelStore) New() (doc *AnotherModel)

func (*AnotherModelStore) Query added in v0.2.0

func (*AnotherModelStore) Save added in v0.2.0

func (s *AnotherModelStore) Save(doc *AnotherModel) (updated bool, err error)

func (*AnotherModelStore) Update added in v0.2.0

func (s *AnotherModelStore) Update(doc *AnotherModel) error

type AnotherType added in v0.2.0

type AnotherType struct {
	X int
	Y int
}

type MyModel added in v0.2.0

type MyModel struct {
	storable.Document `bson:",inline" collection:"my_model"`

	String        string
	Int           int `bson:"bla2"`
	Bytes         []byte
	Slice         []string
	SliceAlias    SliceAlias
	NestedRef     *SomeType
	Nested        SomeType
	NestedSlice   []*SomeType
	AliasOfString Alias
	Time          time.Time
	MapsOfString  map[string]string
	InlineStruct  struct {
		MapOfString   map[string]string
		MapOfSomeType map[string]SomeType
	}
}

func (*MyModel) IrrelevantFunction added in v0.2.0

func (m *MyModel) IrrelevantFunction()

type MyModelQuery added in v0.2.0

type MyModelQuery struct {
	storable.BaseQuery
}

func (*MyModelQuery) FindById added in v0.2.0

func (q *MyModelQuery) FindById(ids ...bson.ObjectId)

type MyModelResultSet added in v0.2.0

type MyModelResultSet struct {
	storable.ResultSet
}

func (*MyModelResultSet) All added in v0.2.0

func (r *MyModelResultSet) All() ([]*MyModel, error)

func (*MyModelResultSet) Next added in v0.2.0

func (r *MyModelResultSet) Next() (*MyModel, error)

func (*MyModelResultSet) One added in v0.2.0

func (r *MyModelResultSet) One() (*MyModel, error)

type MyModelStore added in v0.2.0

type MyModelStore struct {
	storable.Store
}

func NewMyModelStore added in v0.2.0

func NewMyModelStore(db *mgo.Database) *MyModelStore

func (*MyModelStore) Find added in v0.2.0

func (s *MyModelStore) Find(query *MyModelQuery) (*MyModelResultSet, error)

func (*MyModelStore) FindOne added in v0.2.0

func (s *MyModelStore) FindOne(query *MyModelQuery) (*MyModel, error)

func (*MyModelStore) Insert added in v0.2.0

func (s *MyModelStore) Insert(doc *MyModel) error

func (*MyModelStore) MustFind added in v0.2.0

func (s *MyModelStore) MustFind(query *MyModelQuery) *MyModelResultSet

func (*MyModelStore) MustFindOne added in v0.2.0

func (s *MyModelStore) MustFindOne(query *MyModelQuery) *MyModel

func (*MyModelStore) New added in v0.2.0

func (s *MyModelStore) New() (doc *MyModel)

func (*MyModelStore) Query added in v0.2.0

func (s *MyModelStore) Query() *MyModelQuery

func (*MyModelStore) Save added in v0.2.0

func (s *MyModelStore) Save(doc *MyModel) (updated bool, err error)

func (*MyModelStore) Update added in v0.2.0

func (s *MyModelStore) Update(doc *MyModel) error

type SliceAlias added in v0.2.0

type SliceAlias []string

type SomeType added in v0.2.0

type SomeType struct {
	X       int
	Y       int
	Another AnotherType
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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