Documentation
¶
Overview ¶
Package studio provides a built-in admin panel for Nimbus applications.
Studio auto-discovers GORM models and generates a full CRUD admin interface with listing, filtering, sorting, pagination, create/edit forms, and relationship management — all from a single plugin registration.
Usage:
app.RegisterPlugin(studio.NewPlugin(studio.Config{
Path: "/_studio",
Models: []any{&models.User{}, &models.Post{}},
}))
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Path prefix for the admin panel (default: "/_studio").
Path string
// Models to register in the admin panel.
Models []any
// DB is the GORM database connection.
DB *lucid.DB
// Title of the admin panel (default: "Nimbus Studio").
Title string
// BrandColor for the header (default: "#6366f1").
BrandColor string
// Auth middleware to protect the admin panel.
Auth router.Middleware
// ReadOnly prevents create/update/delete operations.
ReadOnly bool
// PerPage default pagination size (default: 25).
PerPage int
// CustomActions for models.
CustomActions map[string][]ModelAction
// Dashboard widgets.
Widgets []Widget
}
Config configures the Studio admin panel.
type FieldMeta ¶
type FieldMeta struct {
Name string `json:"name"`
Column string `json:"column"`
Type string `json:"type"`
GoType string `json:"go_type"`
Primary bool `json:"primary,omitempty"`
Required bool `json:"required,omitempty"`
Unique bool `json:"unique,omitempty"`
Nullable bool `json:"nullable,omitempty"`
Hidden bool `json:"hidden,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
Sortable bool `json:"sortable"`
Filterable bool `json:"filterable"`
Searchable bool `json:"searchable"`
InputType string `json:"input_type"` // text, textarea, number, email, password, select, checkbox, date, datetime
Relation string `json:"relation,omitempty"`
}
FieldMeta describes a model field.
type ModelAction ¶
type ModelAction struct {
Name string
Label string
Icon string
Handler func(db *lucid.DB, ids []uint) error
Bulk bool // can be applied to multiple records
Destructive bool
}
ModelAction defines a custom action on a model.
type ModelMeta ¶
type ModelMeta struct {
Name string `json:"name"`
Table string `json:"table"`
Fields []FieldMeta `json:"fields"`
Type reflect.Type `json:"-"`
Searchable []string `json:"searchable"`
Sortable []string `json:"sortable"`
Filterable []string `json:"filterable"`
}
ModelMeta holds introspected metadata about a registered model.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is the Nimbus Studio admin panel plugin.
func (*Plugin) RegisterRoutes ¶
RegisterRoutes mounts the Studio admin panel routes.
Click to show internal directories.
Click to hide internal directories.