associations

package
v4.11.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsZeroOfUnderlyingType

func IsZeroOfUnderlyingType(x interface{}) bool

IsZeroOfUnderlyingType will check if the value of anything is the equal to the Zero value of that type.

Types

type Association

type Association interface {
	Kind() reflect.Kind
	Interface() interface{}
	Constraint() (string, []interface{})
	InnerAssociations() InnerAssociations
	Skipped() bool
}

Association represents a definition of a model association field. It can represent a association of the type has_many belongs_to or has_one, and other customized types.

type AssociationAfterCreatable

type AssociationAfterCreatable interface {
	AfterInterface() interface{}
	AfterSetup() error
	AfterProcess() AssociationStatement
	Association
}

AssociationAfterCreatable allows an association to be created after the parent structure.

type AssociationBeforeCreatable

type AssociationBeforeCreatable interface {
	BeforeInterface() interface{}
	BeforeSetup() error
	Association
}

AssociationBeforeCreatable allows an association to be created before the parent structure.

type AssociationCreatableStatement

type AssociationCreatableStatement interface {
	Statements() []AssociationStatement
	Association
}

AssociationCreatableStatement a association that defines create statements on database.

type AssociationSortable

type AssociationSortable interface {
	OrderBy() string
	Association
}

AssociationSortable allows a type to be sortable.

type AssociationStatement

type AssociationStatement struct {
	Statement string
	Args      []interface{}
}

AssociationStatement a type that represents a statement to be executed.

func (AssociationStatement) Empty

func (as AssociationStatement) Empty() bool

Empty is true if the containing Statement is empty.

type Associations

type Associations []Association

Associations a group of model associations.

func AssociationsForStruct deprecated

func AssociationsForStruct(s interface{}, fields ...string) (Associations, error)

AssociationsForStruct returns all associations for the struct specified. It takes into account tags associations like has_many, belongs_to, has_one. it throws an error when it finds a field that does not exist for a model.

Deprecated: use ForStruct instead.

func ForStruct

func ForStruct(s interface{}, fields ...string) (Associations, error)

ForStruct returns all associations for the struct specified. It takes into account tags associations like has_many, belongs_to, has_one. it throws an error when it finds a field that does not exist for a model.

func (Associations) AssociationsAfterCreatable

func (a Associations) AssociationsAfterCreatable() []AssociationAfterCreatable

AssociationsAfterCreatable returns all associations that implement AssociationAfterCreatable interface. Has Many and Has One associations are examples of this implementation.

func (Associations) AssociationsBeforeCreatable

func (a Associations) AssociationsBeforeCreatable() []AssociationBeforeCreatable

AssociationsBeforeCreatable returns all associations that implement AssociationBeforeCreatable interface. Belongs To association is an example of this implementation.

func (Associations) AssociationsCreatableStatement

func (a Associations) AssociationsCreatableStatement() []AssociationCreatableStatement

AssociationsCreatableStatement returns all associations that implement AssociationCreatableStament interface. Many To Many association is an example of this implementation.

type InnerAssociation

type InnerAssociation struct {
	Name   string
	Fields string
}

InnerAssociation is a struct that represents a deep level association. per example Song.Composer, Composer is an inner association for Song.

type InnerAssociations

type InnerAssociations []InnerAssociation

InnerAssociations is a group of InnerAssociation.

Jump to

Keyboard shortcuts

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