Documentation ¶
Index ¶
- func ExcludeDeletedScope(models ...interface{}) pop.ScopeFunc
- func GetForeignKeyAssociations(c *pop.Connection, model interface{}) ([]interface{}, error)
- func GetHasManyForeignKeyAssociations(model interface{}) []interface{}
- func GetHasOneForeignKeyAssociation(model interface{}) interface{}
- func GetModelName(model interface{}) string
- func IsModel(model interface{}) bool
- func SoftDestroy(c *pop.Connection, model interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExcludeDeletedScope ¶
func ExcludeDeletedScope(models ...interface{}) pop.ScopeFunc
ExcludeDeletedScope is a chainable way to remove soft deleted models from your queries using Pop's Scope() command If you are filtering the same model that is being returned you can call this with no arguments and it should give you the desired behavior: db.Scope(utilities.ExcludedDeletedScope()).All(&mtoShipments).
If you are filtering on a join table(s) or need to disambiguate multiple tables with deleted_at columns, then you will need to pass in the model(s) so we can derive the real table names: db.Scope(utilities.ExcludeDeletedScope(models.MTOShipment{})).
Join("mto_shipments", "mto_shipments.move_id = moves.id"). All(&moves)
You won't be able to use this if you have given your table name(s) an alias, so just fall back to a normal where. You also cannot combine Scopes with RawQuery, which disregards any Join, Where, Scope, or Eager that may have been chained to the query.
func GetForeignKeyAssociations ¶
func GetForeignKeyAssociations(c *pop.Connection, model interface{}) ([]interface{}, error)
GetForeignKeyAssociations fetches all the foreign key associations the model has
func GetHasManyForeignKeyAssociations ¶
func GetHasManyForeignKeyAssociations(model interface{}) []interface{}
GetHasManyForeignKeyAssociations fetches the "has_many" foreing key association if not an empty model
func GetHasOneForeignKeyAssociation ¶
func GetHasOneForeignKeyAssociation(model interface{}) interface{}
GetHasOneForeignKeyAssociation fetches the "has_one" foreign key association if not an empty model
func GetModelName ¶
func GetModelName(model interface{}) string
GetModelName returns the name of the model
func IsModel ¶
func IsModel(model interface{}) bool
IsModel verifies if the given interface is a model
func SoftDestroy ¶
func SoftDestroy(c *pop.Connection, model interface{}) error
SoftDestroy soft deletes a record and all foreign key associations from the database
Types ¶
This section is empty.