GoFilament
You're reading the docs for v1.38.0, an older release. Go to v1.40.1 (latest).

Docs v1.38.0 Guide

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,email limits 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 with tables.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 has tables.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, CanCreate and OnCreate. 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/import with a file (multipart), csv or file_base64 (JSON); add dry_run=1 for the preview and mapping ({"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=1 and POST .../import with background=1 answer 202 with the job; GET /admin/api/jobs, /jobs/:id and /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 in Dir on the disk. Jobs run in the process that started them (Concurrency at once); a restart stops running jobs. Delete old files in Dir with 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#

panel.Roles(sqlStore.Roles(), filament.RolesConfig{    // or nil: in memory
    Permissions: map[string]string{"reports.export": "Export reports"}, // your own
    FindUsers: func(ctx *filament.Context, q string) ([]filament.UserRef, error) { ... },
})
  • Admins with the roles.manage permission (or a role with *) get a Roles screen: create roles, tick their permissions, and give roles to users (web, API /admin/api/roles..., Flutter account menu → Roles).
  • Every resource gets <slug>.viewAny, .view, .create, .update, .delete; resources with no Can* callback of their own are checked against them (EnforceResources turns this off). filament.Permission("x") also reads these roles, so your own checks work with them.
  • Nobody can lock themselves out: a change that would take away your own roles.manage is refused. Give the first admin a role with * when you set up the store (store.SaveRole / store.SetUserRoles).

🔖 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(...).

Generated from README.md at v1.38.0 · released Nov 17, 2026