tests

package
v0.0.0-...-79003c6 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	ID int `neuron:"type=primary"`

	AttrString string  `neuron:"type=attr"`
	StringPtr  *string `neuron:"type=attr"`

	Int       int        `neuron:"type=attr"`
	CreatedAt time.Time  `neuron:"type=attr"`
	UpdatedAt *time.Time `neuron:"type=attr"`
	DeletedAt *time.Time `neuron:"type=attr"`
}

Model is the generic model used for insertion.

func (*Model) GetFieldValue

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

GetFieldValue implements mapping.Fielder interface.

func (*Model) GetFieldZeroValue

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

GetFieldZeroValue implements mapping.Fielder interface.s

func (*Model) GetFieldsAddress

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

GetFieldsAddress gets the address of provided 'field'.

func (*Model) GetHashableFieldValue

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

GetHashableFieldValue implements mapping.Fielder interface.

func (*Model) GetPrimaryKeyAddress

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

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*Model) GetPrimaryKeyHashableValue

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

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*Model) GetPrimaryKeyStringValue

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

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Model) GetPrimaryKeyValue

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

GetPrimaryKeyValue implements mapping.Model interface method.

func (*Model) GetPrimaryKeyZeroValue

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

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*Model) IsFieldZero

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

IsFieldZero implements mapping.Fielder interface.

func (*Model) IsPrimaryKeyZero

func (m *Model) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*Model) NeuronCollectionName

func (m *Model) NeuronCollectionName() string

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

func (*Model) ParseFieldsStringValue

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

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Model) SetFieldValue

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

SetFieldValue implements mapping.Fielder interface.

func (*Model) SetFieldZeroValue

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

SetFieldZeroValue implements mapping.Fielder interface.s

func (*Model) SetPrimaryKeyStringValue

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

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Model) SetPrimaryKeyValue

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

SetPrimaryKey implements mapping.Model interface method.

type OmitModel

type OmitModel struct {
	ID        int
	OmitField string `db:"-"`
}

OmitModel is the model with omitted field.

func (*OmitModel) GetFieldValue

func (o *OmitModel) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*OmitModel) GetFieldZeroValue

func (o *OmitModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*OmitModel) GetFieldsAddress

func (o *OmitModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*OmitModel) GetHashableFieldValue

func (o *OmitModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*OmitModel) GetPrimaryKeyAddress

func (o *OmitModel) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*OmitModel) GetPrimaryKeyHashableValue

func (o *OmitModel) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*OmitModel) GetPrimaryKeyStringValue

func (o *OmitModel) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*OmitModel) GetPrimaryKeyValue

func (o *OmitModel) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*OmitModel) GetPrimaryKeyZeroValue

func (o *OmitModel) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*OmitModel) IsFieldZero

func (o *OmitModel) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*OmitModel) IsPrimaryKeyZero

func (o *OmitModel) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*OmitModel) NeuronCollectionName

func (o *OmitModel) NeuronCollectionName() string

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

func (*OmitModel) ParseFieldsStringValue

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

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*OmitModel) SetFieldValue

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

SetFieldValue implements mapping.Fielder interface.

func (*OmitModel) SetFieldZeroValue

func (o *OmitModel) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*OmitModel) SetPrimaryKeyStringValue

func (o *OmitModel) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*OmitModel) SetPrimaryKeyValue

func (o *OmitModel) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

type SimpleModel

type SimpleModel struct {
	ID        int        `neuron:"type=primary"`
	Attr      string     `neuron:"type=attr"`
	CreatedAt *time.Time `neuron:"type=attr"`
}

InsertModel is the model prepared for insertion.

func (*SimpleModel) GetFieldValue

func (s *SimpleModel) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*SimpleModel) GetFieldZeroValue

func (s *SimpleModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*SimpleModel) GetFieldsAddress

func (s *SimpleModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*SimpleModel) GetHashableFieldValue

func (s *SimpleModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*SimpleModel) GetPrimaryKeyAddress

func (s *SimpleModel) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*SimpleModel) GetPrimaryKeyHashableValue

func (s *SimpleModel) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*SimpleModel) GetPrimaryKeyStringValue

func (s *SimpleModel) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*SimpleModel) GetPrimaryKeyValue

func (s *SimpleModel) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*SimpleModel) GetPrimaryKeyZeroValue

func (s *SimpleModel) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*SimpleModel) IsFieldZero

func (s *SimpleModel) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*SimpleModel) IsPrimaryKeyZero

func (s *SimpleModel) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*SimpleModel) NeuronCollectionName

func (s *SimpleModel) NeuronCollectionName() string

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

func (*SimpleModel) ParseFieldsStringValue

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

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*SimpleModel) SetFieldValue

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

SetFieldValue implements mapping.Fielder interface.

func (*SimpleModel) SetFieldZeroValue

func (s *SimpleModel) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*SimpleModel) SetPrimaryKeyStringValue

func (s *SimpleModel) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*SimpleModel) SetPrimaryKeyValue

func (s *SimpleModel) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

Jump to

Keyboard shortcuts

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