Documentation
¶
Index ¶
- func BatchProcessing[T any](ctx context.Context, batchSize int, query *gorm.DB, ...) error
- func IsGormErrRecordNotFound(err error) bool
- func MergeJSONBMetadata(db *gorm.DB, model any, id string, field string, metadata map[string]any) error
- func SetJSONBMetadataKey(field, key string, value any) func(*gorm.DB) *gorm.DB
- func TemporalDoNotRetry(err error, args ...string) error
- func TemporalGormError(err error, args ...string) error
- func ToHstore(val map[string]string) pgtype.Hstore
- func ToJSON(val string) []byte
- func ToPtrStringMap(val map[string]string) map[string]*string
- func ToStringMap(val pgtype.Hstore) map[string]string
- func ToStringMapAny(val pgtype.Hstore) map[string]any
- func WhereJSONBStatusIn(field string, statuses ...string) func(*gorm.DB) *gorm.DB
- type JSONBQuerier
- type JSONBQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchProcessing ¶
func IsGormErrRecordNotFound ¶
func MergeJSONBMetadata ¶ added in v0.19.903
func MergeJSONBMetadata(db *gorm.DB, model any, id string, field string, metadata map[string]any) error
MergeJSONBMetadata reads a JSONB column's "metadata" key, merges the provided key-value pairs, and writes the column back. The model must be a pointer to a GORM model (e.g. &app.QueueSignal{}).
func SetJSONBMetadataKey ¶ added in v0.19.903
SetJSONBMetadataKey returns a GORM scope that atomically sets a single key inside the metadata sub-object of a JSONB column via jsonb_set. Executes the update as part of the scope — chain .Where() calls before .Scopes().
Example:
db.Model(&app.RunnerProcess{}).
Where("composite_status::jsonb ->> 'status' = ?", "active").
Scopes(generics.SetJSONBMetadataKey("composite_status", "shutdown_requested", true))
func TemporalDoNotRetry ¶
func TemporalGormError ¶
func WhereJSONBStatusIn ¶ added in v0.19.903
WhereJSONBStatusIn returns a GORM scope that filters rows where the "status" key inside a JSONB column matches one of the provided values.
Example:
db.Model(&app.RunnerProcess{}).
Scopes(generics.WhereJSONBStatusIn("composite_status", "active", "offline")).
Find(&results)
Types ¶
type JSONBQuerier ¶
JSONBQuerier helps build JSONB queries
func NewJSONBQuery ¶
func NewJSONBQuery(db *gorm.DB) *JSONBQuerier
NewJSONBQuery creates a new JSONB query helper
func (*JSONBQuerier) WhereJSON ¶
func (jq *JSONBQuerier) WhereJSON(queryArgs JSONBQuery) *gorm.DB
WhereJSON adds a WHERE condition for JSONB field
func (*JSONBQuerier) WhereJSONPath ¶
func (jq *JSONBQuerier) WhereJSONPath(field string, path []string, operator string, value interface{}) *gorm.DB
WhereJSONPath queries nested JSON paths