Documentation
¶
Overview ¶
Package validation holds checks that need the database.
Index ¶
- func CheckFieldUniqueness(tx *gorm.DB, collectionID uint, fieldName string, value any, excludeID uint) error
- func CheckLocalizedUniqueness(tx *gorm.DB, collectionID uint, locale, fieldName string, value any, ...) error
- func JSONPath(key string) string
- func JSONTextExpr(dialect, key string) (string, any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFieldUniqueness ¶
func CheckFieldUniqueness(tx *gorm.DB, collectionID uint, fieldName string, value any, excludeID uint) error
CheckFieldUniqueness checks that no other live item of the collection has the same value for fieldName. excludeID (the item being updated, or 0) is ignored, and so are soft-deleted items. tx may be nil.
func CheckLocalizedUniqueness ¶ added in v0.5.0
func CheckLocalizedUniqueness(tx *gorm.DB, collectionID uint, locale, fieldName string, value any, excludeID uint) error
CheckLocalizedUniqueness is CheckFieldUniqueness for a value in another locale than the default: no other live item of the collection may have the same value for fieldName in that locale.
func JSONPath ¶ added in v0.4.0
JSONPath returns the SQLite/MySQL JSON path of a top-level key. The key is quoted, so names with dots, dashes or spaces address the right member.
func JSONTextExpr ¶ added in v0.5.0
JSONTextExpr returns a SQL expression for the text value of a top-level key of the JSON "data" column, and its argument. The key is always bound, never interpolated.
Types ¶
This section is empty.