validation

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package validation holds checks that need the database.

Index

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

func JSONPath(key string) string

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

func JSONTextExpr(dialect, key string) (string, any)

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.

Jump to

Keyboard shortcuts

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