mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2025-12-06 14:26:22 +00:00
Fixed models being icorrectly set and added SetDefaultRegistry
This commit is contained in:
parent
850d7b546c
commit
456c165814
@ -28,6 +28,10 @@ func NewModelRegistry() *DefaultModelRegistry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetDefaultRegistry(registry *DefaultModelRegistry) {
|
||||||
|
defaultRegistry = registry
|
||||||
|
}
|
||||||
|
|
||||||
// AddRegistry adds a registry to the global list of registries
|
// AddRegistry adds a registry to the global list of registries
|
||||||
// Registries are searched in the order they were added
|
// Registries are searched in the order they were added
|
||||||
func AddRegistry(registry *DefaultModelRegistry) {
|
func AddRegistry(registry *DefaultModelRegistry) {
|
||||||
|
|||||||
@ -811,7 +811,7 @@ func (h *Handler) handleUpdate(ctx context.Context, w common.ResponseWriter, id
|
|||||||
dataMap["id"] = targetID
|
dataMap["id"] = targetID
|
||||||
|
|
||||||
// Create update query
|
// Create update query
|
||||||
query := tx.NewUpdate().Model(model).Table(tableName).SetMap(dataMap)
|
query := tx.NewUpdate().Table(tableName).SetMap(dataMap)
|
||||||
pkName := reflection.GetPrimaryKeyName(model)
|
pkName := reflection.GetPrimaryKeyName(model)
|
||||||
query = query.Where(fmt.Sprintf("%s = ?", common.QuoteIdent(pkName)), targetID)
|
query = query.Where(fmt.Sprintf("%s = ?", common.QuoteIdent(pkName)), targetID)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user