Documentation
¶
Index ¶
- func AddRegistry(registry *DefaultModelRegistry)
- func GetModelByName(name string) (interface{}, error)
- func GetModels() []interface{}
- func IterateModels(fn func(name string, model interface{}))
- func RegisterModel(model interface{}, name string) error
- func RegisterModelWithRules(model interface{}, name string, rules ModelRules) error
- func SetDefaultRegistry(registry *DefaultModelRegistry)
- func SetModelRules(name string, rules ModelRules) error
- type DefaultModelRegistry
- func (r *DefaultModelRegistry) GetAllModels() map[string]interface{}
- func (r *DefaultModelRegistry) GetModel(name string) (interface{}, error)
- func (r *DefaultModelRegistry) GetModelByEntity(schema, entity string) (interface{}, error)
- func (r *DefaultModelRegistry) GetModelRules(name string) (ModelRules, error)
- func (r *DefaultModelRegistry) RegisterModel(name string, model interface{}) error
- func (r *DefaultModelRegistry) RegisterModelWithRules(name string, model interface{}, rules ModelRules) error
- func (r *DefaultModelRegistry) SetModelRules(name string, rules ModelRules) error
- type ModelRules
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddRegistry ¶ added in v0.0.34
func AddRegistry(registry *DefaultModelRegistry)
AddRegistry adds a registry to the global list of registries Registries are searched in the order they were added
func GetModelByName ¶
GetModelByName retrieves a model by searching through all registries in order Returns the first match found
func GetModels ¶
func GetModels() []interface{}
GetModels returns a list of all models from all registries Models are collected in registry order, with duplicates included
func IterateModels ¶
func IterateModels(fn func(name string, model interface{}))
IterateModels iterates over all models in the default global registry
func RegisterModel ¶
RegisterModel registers a model with the default global registry
func RegisterModelWithRules ¶ added in v0.0.108
func RegisterModelWithRules(model interface{}, name string, rules ModelRules) error
RegisterModelWithRules registers a model with specific rules in the default registry
func SetDefaultRegistry ¶ added in v0.0.35
func SetDefaultRegistry(registry *DefaultModelRegistry)
func SetModelRules ¶ added in v0.0.108
func SetModelRules(name string, rules ModelRules) error
SetModelRules sets the rules for a specific model in the default registry
Types ¶
type DefaultModelRegistry ¶
type DefaultModelRegistry struct {
// contains filtered or unexported fields
}
DefaultModelRegistry implements ModelRegistry interface
func GetDefaultRegistry ¶ added in v0.0.88
func GetDefaultRegistry() *DefaultModelRegistry
func NewModelRegistry ¶
func NewModelRegistry() *DefaultModelRegistry
NewModelRegistry creates a new model registry
func (*DefaultModelRegistry) GetAllModels ¶
func (r *DefaultModelRegistry) GetAllModels() map[string]interface{}
func (*DefaultModelRegistry) GetModel ¶
func (r *DefaultModelRegistry) GetModel(name string) (interface{}, error)
func (*DefaultModelRegistry) GetModelByEntity ¶
func (r *DefaultModelRegistry) GetModelByEntity(schema, entity string) (interface{}, error)
func (*DefaultModelRegistry) GetModelRules ¶ added in v0.0.108
func (r *DefaultModelRegistry) GetModelRules(name string) (ModelRules, error)
GetModelRules retrieves the rules for a specific model Returns default rules if model exists but rules are not set
func (*DefaultModelRegistry) RegisterModel ¶
func (r *DefaultModelRegistry) RegisterModel(name string, model interface{}) error
func (*DefaultModelRegistry) RegisterModelWithRules ¶ added in v0.0.108
func (r *DefaultModelRegistry) RegisterModelWithRules(name string, model interface{}, rules ModelRules) error
RegisterModelWithRules registers a model with specific rules
func (*DefaultModelRegistry) SetModelRules ¶ added in v0.0.108
func (r *DefaultModelRegistry) SetModelRules(name string, rules ModelRules) error
SetModelRules sets the rules for a specific model
type ModelRules ¶ added in v0.0.108
type ModelRules struct {
CanRead bool // Whether the model can be read (GET operations)
CanUpdate bool // Whether the model can be updated (PUT/PATCH operations)
CanCreate bool // Whether the model can be created (POST operations)
CanDelete bool // Whether the model can be deleted (DELETE operations)
SecurityDisabled bool // Whether security checks are disabled for this model
}
ModelRules defines the permissions and security settings for a model
func DefaultModelRules ¶ added in v0.0.108
func DefaultModelRules() ModelRules
DefaultModelRules returns the default rules for a model (all operations allowed, security enabled)
func GetModelRules ¶ added in v0.0.108
func GetModelRules(name string) (ModelRules, error)
GetModelRules retrieves the rules for a specific model from the default registry
func GetModelRulesByName ¶ added in v0.0.108
func GetModelRulesByName(name string) (ModelRules, error)
GetModelRulesByName retrieves the rules for a model by searching through all registries in order Returns the first match found