Documentation
¶
Index ¶
- type Model
- func (m *Model) GetFieldValue(field *mapping.StructField) (interface{}, error)
- func (m *Model) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)
- func (m *Model) GetFieldsAddress(field *mapping.StructField) (interface{}, error)
- func (m *Model) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)
- func (m *Model) GetPrimaryKeyAddress() interface{}
- func (m *Model) GetPrimaryKeyHashableValue() interface{}
- func (m *Model) GetPrimaryKeyStringValue() (string, error)
- func (m *Model) GetPrimaryKeyValue() interface{}
- func (m *Model) GetPrimaryKeyZeroValue() interface{}
- func (m *Model) IsFieldZero(field *mapping.StructField) (bool, error)
- func (m *Model) IsPrimaryKeyZero() bool
- func (m *Model) NeuronCollectionName() string
- func (m *Model) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)
- func (m *Model) SetFieldValue(field *mapping.StructField, value interface{}) (err error)
- func (m *Model) SetFieldZeroValue(field *mapping.StructField) error
- func (m *Model) SetPrimaryKeyStringValue(value string) error
- func (m *Model) SetPrimaryKeyValue(value interface{}) error
- type OmitModel
- func (o *OmitModel) GetFieldValue(field *mapping.StructField) (interface{}, error)
- func (o *OmitModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)
- func (o *OmitModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)
- func (o *OmitModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)
- func (o *OmitModel) GetPrimaryKeyAddress() interface{}
- func (o *OmitModel) GetPrimaryKeyHashableValue() interface{}
- func (o *OmitModel) GetPrimaryKeyStringValue() (string, error)
- func (o *OmitModel) GetPrimaryKeyValue() interface{}
- func (o *OmitModel) GetPrimaryKeyZeroValue() interface{}
- func (o *OmitModel) IsFieldZero(field *mapping.StructField) (bool, error)
- func (o *OmitModel) IsPrimaryKeyZero() bool
- func (o *OmitModel) NeuronCollectionName() string
- func (o *OmitModel) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)
- func (o *OmitModel) SetFieldValue(field *mapping.StructField, value interface{}) (err error)
- func (o *OmitModel) SetFieldZeroValue(field *mapping.StructField) error
- func (o *OmitModel) SetPrimaryKeyStringValue(value string) error
- func (o *OmitModel) SetPrimaryKeyValue(value interface{}) error
- type SimpleModel
- func (s *SimpleModel) GetFieldValue(field *mapping.StructField) (interface{}, error)
- func (s *SimpleModel) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)
- func (s *SimpleModel) GetFieldsAddress(field *mapping.StructField) (interface{}, error)
- func (s *SimpleModel) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)
- func (s *SimpleModel) GetPrimaryKeyAddress() interface{}
- func (s *SimpleModel) GetPrimaryKeyHashableValue() interface{}
- func (s *SimpleModel) GetPrimaryKeyStringValue() (string, error)
- func (s *SimpleModel) GetPrimaryKeyValue() interface{}
- func (s *SimpleModel) GetPrimaryKeyZeroValue() interface{}
- func (s *SimpleModel) IsFieldZero(field *mapping.StructField) (bool, error)
- func (s *SimpleModel) IsPrimaryKeyZero() bool
- func (s *SimpleModel) NeuronCollectionName() string
- func (s *SimpleModel) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)
- func (s *SimpleModel) SetFieldValue(field *mapping.StructField, value interface{}) (err error)
- func (s *SimpleModel) SetFieldZeroValue(field *mapping.StructField) error
- func (s *SimpleModel) SetPrimaryKeyStringValue(value string) error
- func (s *SimpleModel) SetPrimaryKeyValue(value interface{}) error
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 ¶
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 ¶
IsPrimaryKeyZero implements mapping.Model interface method.
func (*Model) NeuronCollectionName ¶
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 ¶
SetPrimaryKeyStringValue implements mapping.Model interface method.
func (*Model) SetPrimaryKeyValue ¶
SetPrimaryKey implements mapping.Model interface method.
type OmitModel ¶
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 ¶
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 ¶
IsPrimaryKeyZero implements mapping.Model interface method.
func (*OmitModel) NeuronCollectionName ¶
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 ¶
SetPrimaryKeyStringValue implements mapping.Model interface method.
func (*OmitModel) SetPrimaryKeyValue ¶
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.