testmodels

package
v0.21.6 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Neuron_Models stores all generated models in this package.

Functions

This section is empty.

Types

type Blog

type Blog struct {
	ID            int       `neuron:"type=primary"`
	Title         string    `neuron:"type=attr;name=title"`
	Posts         []*Post   `neuron:"type=relation;name=posts;foreign=BlogID"`
	CurrentPost   *Post     `neuron:"type=relation;name=current_post"`
	CurrentPostID uint64    `neuron:"type=foreign;name=current_post_id"`
	CreatedAt     time.Time `neuron:"type=attr;name=created_at;flags=iso8601"`
	ViewCount     int       `neuron:"type=attr;name=view_count;flags=omitempty"`
}

Blog is a blog model.

func (*Blog) AddRelationModel

func (b *Blog) AddRelationModel(relation *mapping.StructField, model mapping.Model) error

AddRelationModel implements mapping.MultiRelationer interface.

func (*Blog) GetFieldValue

func (b *Blog) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*Blog) GetFieldZeroValue

func (b *Blog) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*Blog) GetFieldsAddress

func (b *Blog) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*Blog) GetHashableFieldValue

func (b *Blog) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*Blog) GetPrimaryKeyAddress

func (b *Blog) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*Blog) GetPrimaryKeyHashableValue

func (b *Blog) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*Blog) GetPrimaryKeyStringValue

func (b *Blog) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Blog) GetPrimaryKeyValue

func (b *Blog) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*Blog) GetPrimaryKeyZeroValue

func (b *Blog) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*Blog) GetRelationLen

func (b *Blog) GetRelationLen(relation *mapping.StructField) (int, error)

GetRelationLen implements mapping.MultiRelationer interface.

func (*Blog) GetRelationModel

func (b *Blog) GetRelationModel(relation *mapping.StructField) (mapping.Model, error)

GetRelationModel implements mapping.SingleRelationer interface.

func (*Blog) GetRelationModelAt

func (b *Blog) GetRelationModelAt(relation *mapping.StructField, index int) (models mapping.Model, err error)

GetRelationModelAt implements mapping.MultiRelationer interface.

func (*Blog) GetRelationModels

func (b *Blog) GetRelationModels(relation *mapping.StructField) (models []mapping.Model, err error)

GetRelationModels implements mapping.MultiRelationer interface.

func (*Blog) IsFieldZero

func (b *Blog) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*Blog) IsPrimaryKeyZero

func (b *Blog) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*Blog) NeuronCollectionName

func (b *Blog) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'Blog'.

func (*Blog) ParseFieldsStringValue

func (b *Blog) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Blog) SetFieldValue

func (b *Blog) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*Blog) SetFieldZeroValue

func (b *Blog) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*Blog) SetFrom

func (b *Blog) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*Blog) SetPrimaryKeyStringValue

func (b *Blog) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Blog) SetPrimaryKeyValue

func (b *Blog) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*Blog) SetRelationModel

func (b *Blog) SetRelationModel(relation *mapping.StructField, model mapping.Model) error

SetRelationModel implements mapping.SingleRelationer interface.

func (*Blog) SetRelationModels

func (b *Blog) SetRelationModels(relation *mapping.StructField, models ...mapping.Model) error

SetRelationModels implements mapping.MultiRelationer interface.

type Comment

type Comment struct {
	ID     int `neuron:"type=primary"`
	Post   *Post
	PostID uint64 `neuron:"type=foreign"`
	Body   string `neuron:"type=attr;name=body"`
}

Comment is a comment model.

func (*Comment) GetFieldValue

func (c *Comment) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*Comment) GetFieldZeroValue

func (c *Comment) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*Comment) GetFieldsAddress

func (c *Comment) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*Comment) GetHashableFieldValue

func (c *Comment) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*Comment) GetPrimaryKeyAddress

func (c *Comment) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*Comment) GetPrimaryKeyHashableValue

func (c *Comment) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*Comment) GetPrimaryKeyStringValue

func (c *Comment) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Comment) GetPrimaryKeyValue

func (c *Comment) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*Comment) GetPrimaryKeyZeroValue

func (c *Comment) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*Comment) GetRelationModel

func (c *Comment) GetRelationModel(relation *mapping.StructField) (mapping.Model, error)

GetRelationModel implements mapping.SingleRelationer interface.

func (*Comment) IsFieldZero

func (c *Comment) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*Comment) IsPrimaryKeyZero

func (c *Comment) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*Comment) NeuronCollectionName

func (c *Comment) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'Comment'.

func (*Comment) ParseFieldsStringValue

func (c *Comment) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Comment) SetFieldValue

func (c *Comment) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*Comment) SetFieldZeroValue

func (c *Comment) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*Comment) SetFrom

func (c *Comment) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*Comment) SetPrimaryKeyStringValue

func (c *Comment) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Comment) SetPrimaryKeyValue

func (c *Comment) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*Comment) SetRelationModel

func (c *Comment) SetRelationModel(relation *mapping.StructField, model mapping.Model) error

SetRelationModel implements mapping.SingleRelationer interface.

type FilterNestedModel

type FilterNestedModel struct {
	Field string
}

FilterNestedModel is nested field for the model.

type FilterRelationModel

type FilterRelationModel struct {
	ID int `neuron:"type=primary"`
}

FilterRelationModel is a relation for the filter tests.

func (*FilterRelationModel) GetFieldValue

func (f *FilterRelationModel) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*FilterRelationModel) GetFieldZeroValue

func (f *FilterRelationModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*FilterRelationModel) GetFieldsAddress

func (f *FilterRelationModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*FilterRelationModel) GetHashableFieldValue

func (f *FilterRelationModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*FilterRelationModel) GetPrimaryKeyAddress

func (f *FilterRelationModel) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*FilterRelationModel) GetPrimaryKeyHashableValue

func (f *FilterRelationModel) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*FilterRelationModel) GetPrimaryKeyStringValue

func (f *FilterRelationModel) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*FilterRelationModel) GetPrimaryKeyValue

func (f *FilterRelationModel) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*FilterRelationModel) GetPrimaryKeyZeroValue

func (f *FilterRelationModel) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*FilterRelationModel) IsFieldZero

func (f *FilterRelationModel) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*FilterRelationModel) IsPrimaryKeyZero

func (f *FilterRelationModel) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*FilterRelationModel) NeuronCollectionName

func (f *FilterRelationModel) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'FilterRelationModel'.

func (*FilterRelationModel) ParseFieldsStringValue

func (f *FilterRelationModel) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*FilterRelationModel) SetFieldValue

func (f *FilterRelationModel) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*FilterRelationModel) SetFieldZeroValue

func (f *FilterRelationModel) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*FilterRelationModel) SetFrom

func (f *FilterRelationModel) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*FilterRelationModel) SetPrimaryKeyStringValue

func (f *FilterRelationModel) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*FilterRelationModel) SetPrimaryKeyValue

func (f *FilterRelationModel) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

type ForeignModel

type ForeignModel struct {
	ID         int `neuron:"type=primary"`
	ForeignKey int `neuron:"type=foreign"`
}

ForeignModel is the model that have foreign key.

func (*ForeignModel) GetFieldValue

func (f *ForeignModel) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*ForeignModel) GetFieldZeroValue

func (f *ForeignModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*ForeignModel) GetFieldsAddress

func (f *ForeignModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*ForeignModel) GetHashableFieldValue

func (f *ForeignModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*ForeignModel) GetPrimaryKeyAddress

func (f *ForeignModel) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*ForeignModel) GetPrimaryKeyHashableValue

func (f *ForeignModel) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*ForeignModel) GetPrimaryKeyStringValue

func (f *ForeignModel) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*ForeignModel) GetPrimaryKeyValue

func (f *ForeignModel) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*ForeignModel) GetPrimaryKeyZeroValue

func (f *ForeignModel) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*ForeignModel) IsFieldZero

func (f *ForeignModel) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*ForeignModel) IsPrimaryKeyZero

func (f *ForeignModel) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*ForeignModel) NeuronCollectionName

func (f *ForeignModel) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'ForeignModel'.

func (*ForeignModel) ParseFieldsStringValue

func (f *ForeignModel) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*ForeignModel) SetFieldValue

func (f *ForeignModel) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*ForeignModel) SetFieldZeroValue

func (f *ForeignModel) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*ForeignModel) SetFrom

func (f *ForeignModel) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*ForeignModel) SetPrimaryKeyStringValue

func (f *ForeignModel) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*ForeignModel) SetPrimaryKeyValue

func (f *ForeignModel) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

type ForeignWithRelation

type ForeignWithRelation struct {
	ID         int
	Relation   *HasManyWithRelation `neuron:"foreign=ForeignKey"`
	ForeignKey int                  `neuron:"type=foreign"`
}

ForeignWithRelation is a model that has foreign key

func (*ForeignWithRelation) GetFieldValue

func (f *ForeignWithRelation) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*ForeignWithRelation) GetFieldZeroValue

func (f *ForeignWithRelation) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*ForeignWithRelation) GetFieldsAddress

func (f *ForeignWithRelation) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*ForeignWithRelation) GetHashableFieldValue

func (f *ForeignWithRelation) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*ForeignWithRelation) GetPrimaryKeyAddress

func (f *ForeignWithRelation) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*ForeignWithRelation) GetPrimaryKeyHashableValue

func (f *ForeignWithRelation) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*ForeignWithRelation) GetPrimaryKeyStringValue

func (f *ForeignWithRelation) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*ForeignWithRelation) GetPrimaryKeyValue

func (f *ForeignWithRelation) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*ForeignWithRelation) GetPrimaryKeyZeroValue

func (f *ForeignWithRelation) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*ForeignWithRelation) GetRelationModel

func (f *ForeignWithRelation) GetRelationModel(relation *mapping.StructField) (mapping.Model, error)

GetRelationModel implements mapping.SingleRelationer interface.

func (*ForeignWithRelation) IsFieldZero

func (f *ForeignWithRelation) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*ForeignWithRelation) IsPrimaryKeyZero

func (f *ForeignWithRelation) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*ForeignWithRelation) NeuronCollectionName

func (f *ForeignWithRelation) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'ForeignWithRelation'.

func (*ForeignWithRelation) ParseFieldsStringValue

func (f *ForeignWithRelation) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*ForeignWithRelation) SetFieldValue

func (f *ForeignWithRelation) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*ForeignWithRelation) SetFieldZeroValue

func (f *ForeignWithRelation) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*ForeignWithRelation) SetFrom

func (f *ForeignWithRelation) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*ForeignWithRelation) SetPrimaryKeyStringValue

func (f *ForeignWithRelation) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*ForeignWithRelation) SetPrimaryKeyValue

func (f *ForeignWithRelation) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*ForeignWithRelation) SetRelationModel

func (f *ForeignWithRelation) SetRelationModel(relation *mapping.StructField, model mapping.Model) error

SetRelationModel implements mapping.SingleRelationer interface.

type Formatter

type Formatter struct {
	ID   int                `neuron:"type=primary"`
	Attr string             `neuron:"type=attr"`
	Rel  *FormatterRelation `neuron:"type=relation;foreign=FK"`
	FK   int                `neuron:"type=foreign"`
	Lang string             `neuron:"type=attr;flags=lang"`
}

Formatter is the test model for the query tests.

func (*Formatter) GetFieldValue

func (f *Formatter) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*Formatter) GetFieldZeroValue

func (f *Formatter) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*Formatter) GetFieldsAddress

func (f *Formatter) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*Formatter) GetHashableFieldValue

func (f *Formatter) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*Formatter) GetPrimaryKeyAddress

func (f *Formatter) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*Formatter) GetPrimaryKeyHashableValue

func (f *Formatter) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*Formatter) GetPrimaryKeyStringValue

func (f *Formatter) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Formatter) GetPrimaryKeyValue

func (f *Formatter) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*Formatter) GetPrimaryKeyZeroValue

func (f *Formatter) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*Formatter) GetRelationModel

func (f *Formatter) GetRelationModel(relation *mapping.StructField) (mapping.Model, error)

GetRelationModel implements mapping.SingleRelationer interface.

func (*Formatter) IsFieldZero

func (f *Formatter) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*Formatter) IsPrimaryKeyZero

func (f *Formatter) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*Formatter) NeuronCollectionName

func (f *Formatter) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'Formatter'.

func (*Formatter) ParseFieldsStringValue

func (f *Formatter) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Formatter) SetFieldValue

func (f *Formatter) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*Formatter) SetFieldZeroValue

func (f *Formatter) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*Formatter) SetFrom

func (f *Formatter) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*Formatter) SetPrimaryKeyStringValue

func (f *Formatter) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Formatter) SetPrimaryKeyValue

func (f *Formatter) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*Formatter) SetRelationModel

func (f *Formatter) SetRelationModel(relation *mapping.StructField, model mapping.Model) error

SetRelationModel implements mapping.SingleRelationer interface.

type FormatterRelation

type FormatterRelation struct {
	ID int `neuron:"type=primary"`
}

FormatterRelation is the relation model for the query tests.

func (*FormatterRelation) GetFieldValue

func (f *FormatterRelation) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*FormatterRelation) GetFieldZeroValue

func (f *FormatterRelation) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*FormatterRelation) GetFieldsAddress

func (f *FormatterRelation) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*FormatterRelation) GetHashableFieldValue

func (f *FormatterRelation) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*FormatterRelation) GetPrimaryKeyAddress

func (f *FormatterRelation) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*FormatterRelation) GetPrimaryKeyHashableValue

func (f *FormatterRelation) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*FormatterRelation) GetPrimaryKeyStringValue

func (f *FormatterRelation) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*FormatterRelation) GetPrimaryKeyValue

func (f *FormatterRelation) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*FormatterRelation) GetPrimaryKeyZeroValue

func (f *FormatterRelation) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*FormatterRelation) IsFieldZero

func (f *FormatterRelation) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*FormatterRelation) IsPrimaryKeyZero

func (f *FormatterRelation) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*FormatterRelation) NeuronCollectionName

func (f *FormatterRelation) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'FormatterRelation'.

func (*FormatterRelation) ParseFieldsStringValue

func (f *FormatterRelation) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*FormatterRelation) SetFieldValue

func (f *FormatterRelation) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*FormatterRelation) SetFieldZeroValue

func (f *FormatterRelation) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*FormatterRelation) SetFrom

func (f *FormatterRelation) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*FormatterRelation) SetPrimaryKeyStringValue

func (f *FormatterRelation) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*FormatterRelation) SetPrimaryKeyValue

func (f *FormatterRelation) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

type HasManyModel

type HasManyModel struct {
	ID      int             `neuron:"type=primary"`
	HasMany []*ForeignModel `neuron:"type=relation;foreign=ForeignKey"`
}

HasManyModel is the model with the has-many relationship.

func (*HasManyModel) AddRelationModel

func (h *HasManyModel) AddRelationModel(relation *mapping.StructField, model mapping.Model) error

AddRelationModel implements mapping.MultiRelationer interface.

func (*HasManyModel) GetFieldValue

func (h *HasManyModel) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*HasManyModel) GetFieldZeroValue

func (h *HasManyModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*HasManyModel) GetFieldsAddress

func (h *HasManyModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*HasManyModel) GetHashableFieldValue

func (h *HasManyModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*HasManyModel) GetPrimaryKeyAddress

func (h *HasManyModel) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*HasManyModel) GetPrimaryKeyHashableValue

func (h *HasManyModel) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*HasManyModel) GetPrimaryKeyStringValue

func (h *HasManyModel) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*HasManyModel) GetPrimaryKeyValue

func (h *HasManyModel) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*HasManyModel) GetPrimaryKeyZeroValue

func (h *HasManyModel) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*HasManyModel) GetRelationLen

func (h *HasManyModel) GetRelationLen(relation *mapping.StructField) (int, error)

GetRelationLen implements mapping.MultiRelationer interface.

func (*HasManyModel) GetRelationModelAt

func (h *HasManyModel) GetRelationModelAt(relation *mapping.StructField, index int) (models mapping.Model, err error)

GetRelationModelAt implements mapping.MultiRelationer interface.

func (*HasManyModel) GetRelationModels

func (h *HasManyModel) GetRelationModels(relation *mapping.StructField) (models []mapping.Model, err error)

GetRelationModels implements mapping.MultiRelationer interface.

func (*HasManyModel) IsFieldZero

func (h *HasManyModel) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*HasManyModel) IsPrimaryKeyZero

func (h *HasManyModel) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*HasManyModel) NeuronCollectionName

func (h *HasManyModel) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'HasManyModel'.

func (*HasManyModel) ParseFieldsStringValue

func (h *HasManyModel) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*HasManyModel) SetFieldValue

func (h *HasManyModel) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*HasManyModel) SetFieldZeroValue

func (h *HasManyModel) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*HasManyModel) SetFrom

func (h *HasManyModel) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*HasManyModel) SetPrimaryKeyStringValue

func (h *HasManyModel) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*HasManyModel) SetPrimaryKeyValue

func (h *HasManyModel) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*HasManyModel) SetRelationModels

func (h *HasManyModel) SetRelationModels(relation *mapping.StructField, models ...mapping.Model) error

SetRelationModels implements mapping.MultiRelationer interface.

type HasManyWithRelation

type HasManyWithRelation struct {
	ID       int
	Relation []*ForeignWithRelation `neuron:"foreign=ForeignKey"`
}

HasManyWithRelation is a model that is used as has many relation.

func (*HasManyWithRelation) AddRelationModel

func (h *HasManyWithRelation) AddRelationModel(relation *mapping.StructField, model mapping.Model) error

AddRelationModel implements mapping.MultiRelationer interface.

func (*HasManyWithRelation) GetFieldValue

func (h *HasManyWithRelation) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*HasManyWithRelation) GetFieldZeroValue

func (h *HasManyWithRelation) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*HasManyWithRelation) GetFieldsAddress

func (h *HasManyWithRelation) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*HasManyWithRelation) GetHashableFieldValue

func (h *HasManyWithRelation) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*HasManyWithRelation) GetPrimaryKeyAddress

func (h *HasManyWithRelation) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*HasManyWithRelation) GetPrimaryKeyHashableValue

func (h *HasManyWithRelation) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*HasManyWithRelation) GetPrimaryKeyStringValue

func (h *HasManyWithRelation) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*HasManyWithRelation) GetPrimaryKeyValue

func (h *HasManyWithRelation) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*HasManyWithRelation) GetPrimaryKeyZeroValue

func (h *HasManyWithRelation) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*HasManyWithRelation) GetRelationLen

func (h *HasManyWithRelation) GetRelationLen(relation *mapping.StructField) (int, error)

GetRelationLen implements mapping.MultiRelationer interface.

func (*HasManyWithRelation) GetRelationModelAt

func (h *HasManyWithRelation) GetRelationModelAt(relation *mapping.StructField, index int) (models mapping.Model, err error)

GetRelationModelAt implements mapping.MultiRelationer interface.

func (*HasManyWithRelation) GetRelationModels

func (h *HasManyWithRelation) GetRelationModels(relation *mapping.StructField) (models []mapping.Model, err error)

GetRelationModels implements mapping.MultiRelationer interface.

func (*HasManyWithRelation) IsFieldZero

func (h *HasManyWithRelation) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*HasManyWithRelation) IsPrimaryKeyZero

func (h *HasManyWithRelation) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*HasManyWithRelation) NeuronCollectionName

func (h *HasManyWithRelation) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'HasManyWithRelation'.

func (*HasManyWithRelation) ParseFieldsStringValue

func (h *HasManyWithRelation) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*HasManyWithRelation) SetFieldValue

func (h *HasManyWithRelation) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*HasManyWithRelation) SetFieldZeroValue

func (h *HasManyWithRelation) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*HasManyWithRelation) SetFrom

func (h *HasManyWithRelation) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*HasManyWithRelation) SetPrimaryKeyStringValue

func (h *HasManyWithRelation) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*HasManyWithRelation) SetPrimaryKeyValue

func (h *HasManyWithRelation) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*HasManyWithRelation) SetRelationModels

func (h *HasManyWithRelation) SetRelationModels(relation *mapping.StructField, models ...mapping.Model) error

SetRelationModels implements mapping.MultiRelationer interface.

type HasOneModel

type HasOneModel struct {
	ID     int           `neuron:"type=primary"`
	HasOne *ForeignModel `neuron:"type=relation;foreign=ForeignKey"`
}

HasOneModel is the model that have has-one relationship.

func (*HasOneModel) GetFieldValue

func (h *HasOneModel) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*HasOneModel) GetFieldZeroValue

func (h *HasOneModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*HasOneModel) GetFieldsAddress

func (h *HasOneModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*HasOneModel) GetHashableFieldValue

func (h *HasOneModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*HasOneModel) GetPrimaryKeyAddress

func (h *HasOneModel) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*HasOneModel) GetPrimaryKeyHashableValue

func (h *HasOneModel) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*HasOneModel) GetPrimaryKeyStringValue

func (h *HasOneModel) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*HasOneModel) GetPrimaryKeyValue

func (h *HasOneModel) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*HasOneModel) GetPrimaryKeyZeroValue

func (h *HasOneModel) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*HasOneModel) GetRelationModel

func (h *HasOneModel) GetRelationModel(relation *mapping.StructField) (mapping.Model, error)

GetRelationModel implements mapping.SingleRelationer interface.

func (*HasOneModel) IsFieldZero

func (h *HasOneModel) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*HasOneModel) IsPrimaryKeyZero

func (h *HasOneModel) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*HasOneModel) NeuronCollectionName

func (h *HasOneModel) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'HasOneModel'.

func (*HasOneModel) ParseFieldsStringValue

func (h *HasOneModel) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*HasOneModel) SetFieldValue

func (h *HasOneModel) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*HasOneModel) SetFieldZeroValue

func (h *HasOneModel) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*HasOneModel) SetFrom

func (h *HasOneModel) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*HasOneModel) SetPrimaryKeyStringValue

func (h *HasOneModel) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*HasOneModel) SetPrimaryKeyValue

func (h *HasOneModel) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*HasOneModel) SetRelationModel

func (h *HasOneModel) SetRelationModel(relation *mapping.StructField, model mapping.Model) error

SetRelationModel implements mapping.SingleRelationer interface.

type JoinModel

type JoinModel struct {
	ID            int `neuron:"type=primary"`
	ForeignKey    int `neuron:"type=foreign"`
	MtMForeignKey int `neuron:"type=foreign"`
}

JoinModel is the model used as a join model for the many2many relationships.

func (*JoinModel) GetFieldValue

func (j *JoinModel) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*JoinModel) GetFieldZeroValue

func (j *JoinModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*JoinModel) GetFieldsAddress

func (j *JoinModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*JoinModel) GetHashableFieldValue

func (j *JoinModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*JoinModel) GetPrimaryKeyAddress

func (j *JoinModel) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*JoinModel) GetPrimaryKeyHashableValue

func (j *JoinModel) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*JoinModel) GetPrimaryKeyStringValue

func (j *JoinModel) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*JoinModel) GetPrimaryKeyValue

func (j *JoinModel) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*JoinModel) GetPrimaryKeyZeroValue

func (j *JoinModel) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*JoinModel) IsFieldZero

func (j *JoinModel) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*JoinModel) IsPrimaryKeyZero

func (j *JoinModel) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*JoinModel) NeuronCollectionName

func (j *JoinModel) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'JoinModel'.

func (*JoinModel) ParseFieldsStringValue

func (j *JoinModel) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*JoinModel) SetFieldValue

func (j *JoinModel) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*JoinModel) SetFieldZeroValue

func (j *JoinModel) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*JoinModel) SetFrom

func (j *JoinModel) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*JoinModel) SetPrimaryKeyStringValue

func (j *JoinModel) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*JoinModel) SetPrimaryKeyValue

func (j *JoinModel) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

type ManyToManyModel

type ManyToManyModel struct {
	ID        int             `neuron:"type=primary"`
	Many2Many []*RelatedModel `neuron:"type=relation;many2many=JoinModel;foreign=ForeignKey,MtMForeignKey"`
}

ManyToManyModel is the model with many2many relationship.

func (*ManyToManyModel) AddRelationModel

func (m *ManyToManyModel) AddRelationModel(relation *mapping.StructField, model mapping.Model) error

AddRelationModel implements mapping.MultiRelationer interface.

func (*ManyToManyModel) GetFieldValue

func (m *ManyToManyModel) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*ManyToManyModel) GetFieldZeroValue

func (m *ManyToManyModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*ManyToManyModel) GetFieldsAddress

func (m *ManyToManyModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*ManyToManyModel) GetHashableFieldValue

func (m *ManyToManyModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*ManyToManyModel) GetPrimaryKeyAddress

func (m *ManyToManyModel) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*ManyToManyModel) GetPrimaryKeyHashableValue

func (m *ManyToManyModel) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*ManyToManyModel) GetPrimaryKeyStringValue

func (m *ManyToManyModel) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*ManyToManyModel) GetPrimaryKeyValue

func (m *ManyToManyModel) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*ManyToManyModel) GetPrimaryKeyZeroValue

func (m *ManyToManyModel) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*ManyToManyModel) GetRelationLen

func (m *ManyToManyModel) GetRelationLen(relation *mapping.StructField) (int, error)

GetRelationLen implements mapping.MultiRelationer interface.

func (*ManyToManyModel) GetRelationModelAt

func (m *ManyToManyModel) GetRelationModelAt(relation *mapping.StructField, index int) (models mapping.Model, err error)

GetRelationModelAt implements mapping.MultiRelationer interface.

func (*ManyToManyModel) GetRelationModels

func (m *ManyToManyModel) GetRelationModels(relation *mapping.StructField) (models []mapping.Model, err error)

GetRelationModels implements mapping.MultiRelationer interface.

func (*ManyToManyModel) IsFieldZero

func (m *ManyToManyModel) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*ManyToManyModel) IsPrimaryKeyZero

func (m *ManyToManyModel) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*ManyToManyModel) NeuronCollectionName

func (m *ManyToManyModel) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'ManyToManyModel'.

func (*ManyToManyModel) ParseFieldsStringValue

func (m *ManyToManyModel) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*ManyToManyModel) SetFieldValue

func (m *ManyToManyModel) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*ManyToManyModel) SetFieldZeroValue

func (m *ManyToManyModel) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*ManyToManyModel) SetFrom

func (m *ManyToManyModel) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*ManyToManyModel) SetPrimaryKeyStringValue

func (m *ManyToManyModel) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*ManyToManyModel) SetPrimaryKeyValue

func (m *ManyToManyModel) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*ManyToManyModel) SetRelationModels

func (m *ManyToManyModel) SetRelationModels(relation *mapping.StructField, models ...mapping.Model) error

SetRelationModels implements mapping.MultiRelationer interface.

type Post

type Post struct {
	ID              uint64     `neuron:"type=primary"`
	BlogID          int        `neuron:"type=foreign"`
	Title           string     `neuron:"type=attr;name=title"`
	Body            string     `neuron:"type=attr;name=body"`
	Comments        []*Comment `neuron:"type=relation;name=comments;foreign=PostID"`
	LatestComment   *Comment   `neuron:"type=relation;name=latest_comment;foreign=LatestCommentID"`
	LatestCommentID int
}

Post is a post model.

func (*Post) AddRelationModel

func (p *Post) AddRelationModel(relation *mapping.StructField, model mapping.Model) error

AddRelationModel implements mapping.MultiRelationer interface.

func (*Post) GetFieldValue

func (p *Post) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*Post) GetFieldZeroValue

func (p *Post) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*Post) GetFieldsAddress

func (p *Post) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*Post) GetHashableFieldValue

func (p *Post) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*Post) GetPrimaryKeyAddress

func (p *Post) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*Post) GetPrimaryKeyHashableValue

func (p *Post) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*Post) GetPrimaryKeyStringValue

func (p *Post) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Post) GetPrimaryKeyValue

func (p *Post) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*Post) GetPrimaryKeyZeroValue

func (p *Post) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*Post) GetRelationLen

func (p *Post) GetRelationLen(relation *mapping.StructField) (int, error)

GetRelationLen implements mapping.MultiRelationer interface.

func (*Post) GetRelationModel

func (p *Post) GetRelationModel(relation *mapping.StructField) (mapping.Model, error)

GetRelationModel implements mapping.SingleRelationer interface.

func (*Post) GetRelationModelAt

func (p *Post) GetRelationModelAt(relation *mapping.StructField, index int) (models mapping.Model, err error)

GetRelationModelAt implements mapping.MultiRelationer interface.

func (*Post) GetRelationModels

func (p *Post) GetRelationModels(relation *mapping.StructField) (models []mapping.Model, err error)

GetRelationModels implements mapping.MultiRelationer interface.

func (*Post) IsFieldZero

func (p *Post) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*Post) IsPrimaryKeyZero

func (p *Post) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*Post) NeuronCollectionName

func (p *Post) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'Post'.

func (*Post) ParseFieldsStringValue

func (p *Post) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Post) SetFieldValue

func (p *Post) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*Post) SetFieldZeroValue

func (p *Post) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*Post) SetFrom

func (p *Post) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*Post) SetPrimaryKeyStringValue

func (p *Post) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Post) SetPrimaryKeyValue

func (p *Post) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*Post) SetRelationModel

func (p *Post) SetRelationModel(relation *mapping.StructField, model mapping.Model) error

SetRelationModel implements mapping.SingleRelationer interface.

func (*Post) SetRelationModels

func (p *Post) SetRelationModels(relation *mapping.StructField, models ...mapping.Model) error

SetRelationModels implements mapping.MultiRelationer interface.

type RelatedModel

type RelatedModel struct {
	ID         int     `neuron:"type=primary"`
	FloatField float64 `neuron:"type=attr"`
}

RelatedModel is the related model in the many2many relationship.

func (*RelatedModel) GetFieldValue

func (r *RelatedModel) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*RelatedModel) GetFieldZeroValue

func (r *RelatedModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*RelatedModel) GetFieldsAddress

func (r *RelatedModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*RelatedModel) GetHashableFieldValue

func (r *RelatedModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*RelatedModel) GetPrimaryKeyAddress

func (r *RelatedModel) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*RelatedModel) GetPrimaryKeyHashableValue

func (r *RelatedModel) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*RelatedModel) GetPrimaryKeyStringValue

func (r *RelatedModel) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*RelatedModel) GetPrimaryKeyValue

func (r *RelatedModel) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*RelatedModel) GetPrimaryKeyZeroValue

func (r *RelatedModel) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*RelatedModel) IsFieldZero

func (r *RelatedModel) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*RelatedModel) IsPrimaryKeyZero

func (r *RelatedModel) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*RelatedModel) NeuronCollectionName

func (r *RelatedModel) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'RelatedModel'.

func (*RelatedModel) ParseFieldsStringValue

func (r *RelatedModel) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*RelatedModel) SetFieldValue

func (r *RelatedModel) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*RelatedModel) SetFieldZeroValue

func (r *RelatedModel) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*RelatedModel) SetFrom

func (r *RelatedModel) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*RelatedModel) SetPrimaryKeyStringValue

func (r *RelatedModel) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*RelatedModel) SetPrimaryKeyValue

func (r *RelatedModel) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

type TestingModel

type TestingModel struct {
	ID         int                  `neuron:"type=primary"`
	Attr       string               `neuron:"type=attr"`
	Relation   *FilterRelationModel `neuron:"type=relation;foreign=ForeignKey"`
	ForeignKey int                  `neuron:"type=foreign"`
	Nested     *FilterNestedModel   `neuron:"type=attr"`
}

TestingModel is one of testing models for the query package.

func (*TestingModel) GetFieldValue

func (t *TestingModel) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*TestingModel) GetFieldZeroValue

func (t *TestingModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*TestingModel) GetFieldsAddress

func (t *TestingModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*TestingModel) GetHashableFieldValue

func (t *TestingModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*TestingModel) GetPrimaryKeyAddress

func (t *TestingModel) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*TestingModel) GetPrimaryKeyHashableValue

func (t *TestingModel) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*TestingModel) GetPrimaryKeyStringValue

func (t *TestingModel) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*TestingModel) GetPrimaryKeyValue

func (t *TestingModel) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*TestingModel) GetPrimaryKeyZeroValue

func (t *TestingModel) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*TestingModel) GetRelationModel

func (t *TestingModel) GetRelationModel(relation *mapping.StructField) (mapping.Model, error)

GetRelationModel implements mapping.SingleRelationer interface.

func (*TestingModel) IsFieldZero

func (t *TestingModel) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*TestingModel) IsPrimaryKeyZero

func (t *TestingModel) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*TestingModel) NeuronCollectionName

func (t *TestingModel) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model interface method. Returns the name of the collection for the 'TestingModel'.

func (*TestingModel) ParseFieldsStringValue

func (t *TestingModel) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*TestingModel) SetFieldValue

func (t *TestingModel) SetFieldValue(field *mapping.StructField, value interface{}) (err error)

SetFieldValue implements mapping.Fielder interface.

func (*TestingModel) SetFieldZeroValue

func (t *TestingModel) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*TestingModel) SetFrom

func (t *TestingModel) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*TestingModel) SetPrimaryKeyStringValue

func (t *TestingModel) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*TestingModel) SetPrimaryKeyValue

func (t *TestingModel) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*TestingModel) SetRelationModel

func (t *TestingModel) SetRelationModel(relation *mapping.StructField, model mapping.Model) error

SetRelationModel implements mapping.SingleRelationer interface.

Jump to

Keyboard shortcuts

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