refactor(10.2-01): nest framework packages under modules

- Move remaining beach packages and embedded admin assets\n- Rewrite framework, example, build, and gate paths
This commit is contained in:
Jakub Zych
2026-09-28 02:21:02 +02:00
parent ac1f6d14f4
commit 5e50b166ef
277 changed files with 303 additions and 303 deletions

View File

@@ -0,0 +1,48 @@
package lagoon
import (
"fmt"
"gorm.io/gorm"
)
// HasBeforeValidate is the Winter beforeValidate hook. GORM does not
// dispatch this name; later validation wiring type-asserts it.
type HasBeforeValidate interface {
BeforeValidate(tx *gorm.DB) error
}
// HasBeforeCreate matches GORM's native BeforeCreate hook so a model
// needs no adapter. GORM dispatches it by method name.
type HasBeforeCreate interface {
BeforeCreate(tx *gorm.DB) error
}
// HasBeforeSave matches GORM's native BeforeSave hook so a model
// needs no adapter. GORM dispatches it by method name.
type HasBeforeSave interface {
BeforeSave(tx *gorm.DB) error
}
// HasBeforeDelete matches GORM's native BeforeDelete hook so a model
// needs no adapter. GORM dispatches it by method name.
type HasBeforeDelete interface {
BeforeDelete(tx *gorm.DB) error
}
// HasAfterDelete matches GORM's native AfterDelete hook so a model
// needs no adapter. GORM dispatches it by method name.
type HasAfterDelete interface {
AfterDelete(tx *gorm.DB) error
}
// WithSoftDeleteCascade names the "Collection cascades to Album" pattern
// (DATA-03). Callers invoke it from their own BeforeDelete method: GORM
// already runs BeforeDelete inside the parent Delete transaction, so this
// does not open a new transaction. A cascade error aborts the parent delete.
func WithSoftDeleteCascade(tx *gorm.DB, cascade func(tx *gorm.DB) error) error {
if tx == nil {
return fmt.Errorf("lagoon: soft-delete cascade tx is nil")
}
return cascade(tx)
}