tests

package
v0.0.9 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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Size int = 16

Variables

View Source
var Neuron_Models = []mapping.Model{
	&Car{},
	&User{},
}

Neuron_Models stores all generated models in this package.

Functions

This section is empty.

Types

type Car

type Car struct {
	ID               string
	UserID           uuid.UUID
	Plates           string
	Directory        SqlEnum
	EnumField        Enum
	UintEnumField    UintEnum
	Models           external.Models
	NonPointerModels external.NonPointerModels
}

Car is the test model for generator.

func (*Car) AddRelationModel added in v0.0.6

func (c *Car) AddRelationModel(relation *mapping.StructField, model mapping.Model) error

AddRelationModel implements mapping.MultiRelationer interface.

func (*Car) GetFieldValue

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

GetFieldValue implements mapping.Fielder interface.

func (*Car) GetFieldZeroValue

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

GetFieldZeroValue implements mapping.Fielder interface.s

func (*Car) GetFieldsAddress

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

GetFieldsAddress gets the address of provided 'field'.

func (*Car) GetHashableFieldValue

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

GetHashableFieldValue implements mapping.Fielder interface.

func (*Car) GetPrimaryKeyAddress

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

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*Car) GetPrimaryKeyHashableValue

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

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*Car) GetPrimaryKeyStringValue

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

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Car) GetPrimaryKeyValue

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

GetPrimaryKeyValue implements mapping.Model interface method.

func (*Car) GetPrimaryKeyZeroValue

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

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*Car) GetRelationLen added in v0.0.6

func (c *Car) GetRelationLen(relation *mapping.StructField) (int, error)

GetRelationLen implements mapping.MultiRelationer interface.

func (*Car) GetRelationModelAt added in v0.0.6

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

GetRelationModelAt implements mapping.MultiRelationer interface.

func (*Car) GetRelationModels added in v0.0.6

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

GetRelationModels implements mapping.MultiRelationer interface.

func (*Car) IsFieldZero

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

IsFieldZero implements mapping.Fielder interface.

func (*Car) IsPrimaryKeyZero

func (c *Car) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*Car) ListRelationModels added in v0.0.6

func (c *Car) ListRelationModels() []mapping.Model

ListRelationModels lists unique relation models.

func (*Car) NeuronCollectionName

func (c *Car) NeuronCollectionName() string

NeuronCollectionName implements mapping.Model.

func (*Car) ParseFieldsStringValue

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

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Car) SetFieldValue

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

SetFieldValue implements mapping.Fielder interface.

func (*Car) SetFieldZeroValue

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

SetFieldZeroValue implements mapping.Fielder interface.s

func (*Car) SetFrom

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

SetFrom implements FromSetter interface.

func (*Car) SetPrimaryKeyStringValue

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

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Car) SetPrimaryKeyValue

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

SetPrimaryKey implements mapping.Model interface method.

func (*Car) SetRelationModels added in v0.0.6

func (c *Car) SetRelationModels(relation *mapping.StructField, models ...mapping.Model) error

SetRelationModels implements mapping.MultiRelationer interface.

func (*Car) StructFieldValue

func (c *Car) StructFieldValue(field *mapping.StructField) (interface{}, error)

StructFieldValues gets the value for specified 'field'.

type Enum added in v0.0.3

type Enum int
const (
	FirstE Enum
	SecondE
)

type SqlEnum added in v0.0.5

type SqlEnum uint

SqlEnum represents sql enumerator.

const (
	SqlFirst SqlEnum = iota
	SqlSecond
)

func (SqlEnum) MarshalText added in v0.0.5

func (r SqlEnum) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler interface.

func (*SqlEnum) Scan added in v0.0.5

func (r *SqlEnum) Scan(value interface{}) error

Scan implements sql.Scanner interface.

func (SqlEnum) String added in v0.0.5

func (r SqlEnum) String() string

String implements fmt.Stringer interface.

func (*SqlEnum) UnmarshalText added in v0.0.5

func (r *SqlEnum) UnmarshalText(text []byte) error

UnmarshalText implement encoding.TextUnmarshaler interface.

func (SqlEnum) Valid added in v0.0.5

func (r SqlEnum) Valid() bool

Valid checks the validity of the enum.

func (SqlEnum) Value added in v0.0.5

func (r SqlEnum) Value() (driver.Value, error)

Value implements driver.Valuer interface.

type UUID added in v0.0.3

type UUID [Size]byte

type UintEnum added in v0.0.3

type UintEnum uint
const (
	First UintEnum
	Second
)

func (*UintEnum) Do added in v0.0.5

func (u *UintEnum) Do()

func (UintEnum) String added in v0.0.5

func (u UintEnum) String() string

type User

type User struct {
	ID            uuid.UUID
	CreatedAt     time.Time
	DeletedAt     *time.Time
	Name          *string
	Age           int
	IntArray      []int
	Bytes         []byte
	PtrBytes      *[]byte
	Wrapped       external.Int
	PtrWrapped    *external.Int
	External      *external.Model
	ExternalID    int
	FavoriteCar   Car
	FavoriteCarID string     `db:";notnull"`
	SisterID      *uuid.UUID `db:";notnull"`
	Cars          []*Car
	Sons          []*User   `neuron:"foreign=ParentID"`
	ParentID      uuid.UUID `neuron:"type=foreign"`
	Sister        *User
	CustomUUID    UUID
}

User is testing model.

func (*User) AddRelationModel

func (u *User) AddRelationModel(relation *mapping.StructField, model mapping.Model) error

AddRelationModel implements mapping.MultiRelationer interface.

func (*User) GetFieldValue

func (u *User) GetFieldValue(field *mapping.StructField) (interface{}, error)

GetFieldValue implements mapping.Fielder interface.

func (*User) GetFieldZeroValue

func (u *User) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)

GetFieldZeroValue implements mapping.Fielder interface.s

func (*User) GetFieldsAddress

func (u *User) GetFieldsAddress(field *mapping.StructField) (interface{}, error)

GetFieldsAddress gets the address of provided 'field'.

func (*User) GetHashableFieldValue

func (u *User) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)

GetHashableFieldValue implements mapping.Fielder interface.

func (*User) GetPrimaryKeyAddress

func (u *User) GetPrimaryKeyAddress() interface{}

GetPrimaryKeyAddress implements mapping.Model interface method.

func (*User) GetPrimaryKeyHashableValue

func (u *User) GetPrimaryKeyHashableValue() interface{}

GetPrimaryKeyHashableValue implements mapping.Model interface method.

func (*User) GetPrimaryKeyStringValue

func (u *User) GetPrimaryKeyStringValue() (string, error)

GetPrimaryKeyStringValue implements mapping.Model interface method.

func (*User) GetPrimaryKeyValue

func (u *User) GetPrimaryKeyValue() interface{}

GetPrimaryKeyValue implements mapping.Model interface method.

func (*User) GetPrimaryKeyZeroValue

func (u *User) GetPrimaryKeyZeroValue() interface{}

GetPrimaryKeyZeroValue implements mapping.Model interface method.

func (*User) GetRelationLen

func (u *User) GetRelationLen(relation *mapping.StructField) (int, error)

GetRelationLen implements mapping.MultiRelationer interface.

func (*User) GetRelationModel

func (u *User) GetRelationModel(relation *mapping.StructField) (mapping.Model, error)

GetRelationModel implements mapping.SingleRelationer interface.

func (*User) GetRelationModelAt

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

GetRelationModelAt implements mapping.MultiRelationer interface.

func (*User) GetRelationModels

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

GetRelationModels implements mapping.MultiRelationer interface.

func (*User) IsFieldZero

func (u *User) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*User) IsPrimaryKeyZero

func (u *User) IsPrimaryKeyZero() bool

IsPrimaryKeyZero implements mapping.Model interface method.

func (*User) ListRelationModels added in v0.0.2

func (u *User) ListRelationModels() []mapping.Model

ListRelationModels lists unique relation models.

func (*User) ParseFieldsStringValue

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

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*User) SetFieldValue

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

SetFieldValue implements mapping.Fielder interface.

func (*User) SetFieldZeroValue

func (u *User) SetFieldZeroValue(field *mapping.StructField) error

SetFieldZeroValue implements mapping.Fielder interface.s

func (*User) SetFrom

func (u *User) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*User) SetPrimaryKeyStringValue

func (u *User) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*User) SetPrimaryKeyValue

func (u *User) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*User) SetRelationModel

func (u *User) SetRelationModel(relation *mapping.StructField, model mapping.Model) error

SetRelationModel implements mapping.SingleRelationer interface.

func (*User) SetRelationModels

func (u *User) SetRelationModels(relation *mapping.StructField, models ...mapping.Model) error

SetRelationModels implements mapping.MultiRelationer interface.

func (*User) StructFieldValue

func (u *User) StructFieldValue(field *mapping.StructField) (interface{}, error)

StructFieldValues gets the value for specified 'field'.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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