Compare commits

...

1 Commits

Author SHA1 Message Date
Hein
456c165814 Fixed models being icorrectly set and added SetDefaultRegistry 2025-11-19 18:22:56 +02:00
2 changed files with 5 additions and 1 deletions

View File

@@ -28,6 +28,10 @@ func NewModelRegistry() *DefaultModelRegistry {
}
}
func SetDefaultRegistry(registry *DefaultModelRegistry) {
defaultRegistry = registry
}
// AddRegistry adds a registry to the global list of registries
// Registries are searched in the order they were added
func AddRegistry(registry *DefaultModelRegistry) {

View File

@@ -811,7 +811,7 @@ func (h *Handler) handleUpdate(ctx context.Context, w common.ResponseWriter, id
dataMap["id"] = targetID
// Create update query
query := tx.NewUpdate().Model(model).Table(tableName).SetMap(dataMap)
query := tx.NewUpdate().Table(tableName).SetMap(dataMap)
pkName := reflection.GetPrimaryKeyName(model)
query = query.Where(fmt.Sprintf("%s = ?", common.QuoteIdent(pkName)), targetID)