migrate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MongoTag = "mongo"
	TagName  = "name"
)

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

View Source
const (
	// StoreIndexes is the key used for the model's struct definition that stores the index value
	StoreIndexes = "mongo:index"
)

Constants used in the field's store

Variables

View Source
var (
	ErrIndexUnknownOptions = errors.New("Unknown options found for the index")
)

Errors used while parsing the models into mongo repository

Functions

func ExtractModel

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

ExtractModel migrates the neuron Model into mongo specification

Types

type FieldIndex

type FieldIndex struct {
	Field *mapping.StructField
	Order sorts.Order
}

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 field's index

func (*Index) Model

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

Model gets the mongo.IndexModel version of the index

Jump to

Keyboard shortcuts

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