migrate

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MongoTag = "mongo"
	TagName  = "name"
	OmitKey  = "mongo:omit"
)

Constants used in the mongo tags

View Source
const (
	// TagIndex is used on the struct tags for mongo field definition.
	TagIndex        = "index"
	UniqueIndex     = "unique"
	UUIDIndex       = "uuid"
	DescendingIndex = "desc"
	AscendingIndex  = "asc" // default
)

constants used as the index tags.

Variables

View Source
var StoreIndexes = storeIndexStruct{}

StoreIndexes is the key used for the model's struct definition that stores the index value.

Functions

func ExtractModel

func ExtractModel(m *mapping.ModelStruct) (err error)

ExtractModel migrates the neuron mapped ModelStruct into mongo specification.

Types

type FieldIndex

type FieldIndex struct {
	Field *mapping.StructField
	Order query.SortOrder
}

FieldIndex is the struct used for getting the pair - field:order for the index.

func (FieldIndex) BSON

func (f FieldIndex) BSON() bson.E

BSON gets the bson.E value for the given Field Index.

type Index

type Index struct {
	Fields []FieldIndex
	Name   string
	Unique bool
}

Index is the mongo field's index structure.

func (*Index) Model

func (i *Index) Model() mongo.IndexModel

Model gets the mongo.IndexModel.

Jump to

Keyboard shortcuts

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