Documentation
¶
Index ¶
- type Association
- func (a *Association) Append(values ...any) error
- func (a *Association) AssociationName() string
- func (a *Association) Clear() error
- func (a *Association) Count() int64
- func (a *Association) Delete(values ...any) error
- func (a *Association) Find(out any, conds ...any) error
- func (a *Association) Model() any
- func (a *Association) Query() contractsorm.Query
- func (a *Association) Replace(values ...any) error
- type BelongsTo
- type HasMany
- type HasOne
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Association ¶
type Association struct {
// contains filtered or unexported fields
}
Association represents a model association.
func NewAssociation ¶
func NewAssociation(query contractsorm.Query, model any, association string) *Association
NewAssociation creates a new Association instance.
func (*Association) Append ¶
func (a *Association) Append(values ...any) error
Append appending a model to the association.
func (*Association) AssociationName ¶
func (a *Association) AssociationName() string
AssociationName returns the association name.
func (*Association) Count ¶
func (a *Association) Count() int64
Count returns the number of records in the association.
func (*Association) Delete ¶
func (a *Association) Delete(values ...any) error
Delete deletes the given value from the association.
func (*Association) Find ¶
func (a *Association) Find(out any, conds ...any) error
Find finds records that match given conditions.
func (*Association) Query ¶
func (a *Association) Query() contractsorm.Query
Query returns the underlying query instance.
func (*Association) Replace ¶
func (a *Association) Replace(values ...any) error
Replace replaces the association with the given value.
type BelongsTo ¶
type BelongsTo struct {
*Association
// contains filtered or unexported fields
}
BelongsTo represents a belongs-to relationship.
func NewBelongsTo ¶
func NewBelongsTo(query contractsorm.Query, model any, association, foreignKey, otherKey string) *BelongsTo
NewBelongsTo creates a new BelongsTo association.
type HasMany ¶
type HasMany struct {
*Association
// contains filtered or unexported fields
}
HasMany represents a has-many relationship.
func NewHasMany ¶
func NewHasMany(query contractsorm.Query, model any, association, foreignKey, localKey string) *HasMany
NewHasMany creates a new HasMany association.
func (*HasMany) Clear ¶
Clear clears the association by setting the foreign key to null for all related models.
type HasOne ¶
type HasOne struct {
*Association
// contains filtered or unexported fields
}
HasOne represents a has-one relationship.
func NewHasOne ¶
func NewHasOne(query contractsorm.Query, model any, association, foreignKey, localKey string) *HasOne
NewHasOne creates a new HasOne association.