High-Throughput Data Streaming: Import & Export
GoFilament features a streaming data export and interactive column-mapping import engine designed for large datasets with minimal memory overhead ($O(\text{chunk size})$):
📤 High-Throughput Export:#
- Stream thousands of records directly to the browser or API clients without buffering whole tables in memory.
- Formats supported: CSV (
text/csv), TSV (text/tab-separated-values), Excel (.xlsx,format=xlsx) and JSON (application/json).columns=name,emaillimits the export to those columns. - Automatically exports configured table columns and labels, stripping HTML tags to output clean data.
- Row-level bulk export via
tables.ExportBulkAction(), or header actions withtables.ExportAction(). - Filter-aware: respects table search terms, active column filters, advanced search and selected record IDs. The web list’s Export buttons (CSV and Excel) download the list as it is filtered and sorted.
// Add Export to table header actions or bulk actions
table.HeaderActions(
tables.ExportAction[*Customer](),
tables.ImportAction[*Customer](),
).BulkActions(
tables.ExportBulkAction(),
)
📥 Import with preview:#
- Upload CSV, TSV or Excel (.xlsx) files (up to 10 MB) on the web (
/admin/{resource}/import), from the Flutter app (an Import button when the table hastables.ImportAction) or through the API. - Preview before saving: the file’s columns are matched to form fields (by name or label; change any of them), and every row is checked against the resource form. The preview shows the first rows with their problems and lists all rows that will be skipped; only then are the valid rows imported.
- Same rules as the create form: imported rows go through form validation,
CanCreateandOnCreate. Resources without a form keep the old behaviour (headers are normalized to field names). - Excel dates in date / datetime fields are converted from Excel day numbers.
- API:
POST /admin/api/resources/:slug/importwith afile(multipart),csvorfile_base64(JSON); adddry_run=1for the preview andmapping({"File header": "field"},""skips a column). Results list failed rows with field errors (rows).
✏️ Bulk edit#
res.BulkEditable("status", "owner_id") lets users set one of those form
fields to the same value on many selected rows: a Change Selected bulk
action on the web, a Change button in the Flutter selection bar, and
POST /admin/api/resources/:slug/bulk-update {ids, field, value}. The value
goes through the field’s validation; each record through CanEdit and the
trashed check, then OnUpdate with just that field (or OnBulkUpdate(fn)
once for all). Records that fail are reported, the others are changed. At
most 1000 records per bulk edit.
⏳ Background jobs (long exports and imports)#
panel.BackgroundJobs(filament.JobsConfig{Disk: "local"}) // storage disk for result files
- Web exports then run as a job: the user goes to a progress page
(
/admin/jobs/:id) and gets a notification with a Download link when it is ready. Imports confirmed on the preview page run as jobs too. - API:
GET .../export?background=1andPOST .../importwithbackground=1answer 202 with the job;GET /admin/api/jobs,/jobs/:idand/jobs/:id/download(only the user who started it). The Flutter app’s Export uses this when the panel has jobs. - Job state is kept in golaravel’s cache for
TTL(7 days; use a shared cache store with several instances), result files inDiron the disk. Jobs run in the process that started them (Concurrencyat once); a restart stops running jobs. Delete old files inDirwith a scheduled task.
🎭 Impersonation (“sign in as”)#
With panel.Sessions(...), an admin can sign in as another user to see the
panel as they do:
panel.Impersonation(filament.Impersonation{
CanImpersonate: func(ctx *filament.Context, target auth.Authenticatable) bool {
return isAdmin(ctx.User()) && !isAdmin(target)
},
OnImpersonate: func(ctx *filament.Context, admin, target auth.Authenticatable, leaving bool) { /* audit */ },
})
// a row action on the users table:
tables.Action[*User]("impersonate").Label("Sign in as").URL(func(u *User) string { return panel.ImpersonateURL(u.ID) })
A banner on every page shows who you are signed in as, with Return to my
account. While impersonating, the user’s profile, password and two-factor
settings cannot be changed, and you cannot impersonate someone else. Only the
web engine supports it (no API tokens are issued for other users).
filament.ImpersonatorID(ctx) tells your code who is really signed in.
🗂️ Kanban board#
res.Kanban(filament.KanbanConfig[*Task]{
Field: "status", // OnList receives filters["status"] = column value
Columns: []filament.KanbanColumn{{Value: "todo", Label: "To do"}, {Value: "doing", Label: "Doing"}, {Value: "done", Label: "Done"}},
Title: func(t *Task) string { return t.Title },
Description: func(t *Task) string { return t.Assignee },
})
A Board button on the list (web) and in the Flutter toolbar shows the
records as cards; dragging a card to another column sets the field. A move is
an edit of that one field: form validation, CanEdit, the trashed check,
edit conflicts (Versioned) and OnUpdate (so the audit log records it).
API: GET /admin/api/resources/:slug/board, POST .../board/move {id, value}.
🛡️ Roles and permissions (role bindings)#
Roles are defined once and given to users in a place: a role binding is
{user, role, panel, tenant}, where * means every panel or every tenant (the
model used by Kubernetes and the cloud IAM systems). A user’s permissions are
those of their bindings that cover the panel and tenant they are in now.
store := sqlStore.Roles() // or filament.NewMemoryRoleStore(); panels may share one store
panel.Roles(store, filament.RolesConfig{
Panels: map[string]string{"admin": "Admin", "app": "Customer app"}, // panels sharing the store
Permissions: map[string]string{"reports.export": "Export reports"}, // your own
FindUsers: func(ctx *filament.Context, q string) ([]filament.UserRef, error) { ... },
// Tenants: who can be offered on the screens (default: the panel's TenantLoader)
})
// the first super admin, once:
store.SaveRole(ctx, filament.RoleDef{Name: "super_admin", Label: "Super admin", Permissions: []string{"*"}})
store.AddBinding(ctx, filament.RoleBinding{UserID: "1", Role: "super_admin", Panel: "*", Tenant: "*"})
- Panel access: users need a binding in a panel to use it
(
RequirePanelAccess, default on), so someone can have the admin panel and not the customer app, or the reverse. - Super admins (
roles.manageor*in every panel and tenant) define roles and give any role in one or more panels and tenants at once. - Tenant admins get
roles.assignin their tenant: they give and remove roles only there, and only roles whose permissions they have themselves (never*orroles.manage). - Every resource gets
<slug>.viewAny,.view,.create,.update,.delete; resources without their ownCan*callbacks are checked against them (EnforceResources).filament.Permission("x")reads the bindings too. - Nobody can remove their own right to manage roles (409).
- Screens: Roles (web Settings menu, Flutter account menu) and Users, where
each user’s bindings are listed with Give role (role + panels + tenants).
API:
/admin/api/roles,/roles/users,POST/DELETE /roles/bindings.
🌍 The Flutter app in other languages#
The Flutter app’s own words (buttons, dialogs, messages) follow the panel’s
language: they come with boot as ui_translations, keyed by the English text.
Arabic, German, Spanish and French are built in; add or change words for any
language with:
panel.UITranslations("pt", map[string]string{"Sign in": "Entrar", "{n} selected": "{n} selecionados"})
Keep placeholders such as {n} in the translation. Labels that come from the
panel (resources, fields, columns) use the panel’s normal translations.
🔖 Saved views#
Users can name the current state of a list (search, sort, filters, advanced search, visible columns, grouping, page size), come back to it from a Views menu, and share it with everyone who can see the resource (web and Flutter).
panel.SavedViews(nil) // in memory
panel.SavedViews(sqlStore.Views()) // in the database (pkg/sqlstore)
panel.SavedViewsShareable(
func(ctx *filament.Context) bool { return true }, // who may share
func(ctx *filament.Context) bool { return isAdmin(ctx.User()) }, // who may delete others' shared views
)
API: GET/POST /admin/api/resources/:slug/views, DELETE .../views/:id.
On the web, visible columns are chosen in the browser and are not part of a
saved view.
📥 Interactive Column-Mapping Import:#
- Upload CSV or TSV files via web modal (
/admin/{resource}/import) or REST API. - Smart Auto-Mapping: Automatically normalizes file headers (e.g.,
Customer Name$\rightarrow$customer_name$\rightarrow$name) to match model fields. - Explicit Mapping: Override column definitions with custom mapping fields.
- Batch Processing & Error Resilience: Processes rows sequentially with
OnCreate, collecting failure logs without terminating the batch. - Real-Time Notification: Dispatches toast and drawer notifications with success counts and warning reports via
notifications.Send(...).