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