example/

directory
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: MIT

README

Examples

Each example is a standalone Go program demonstrating one topic. Run any example with go run example/<name>/main.go.

Prerequisites: task up to start Directus, Postgres, and Redis.

# Directory Topic
01 01-basic-crud Read and write items via the Directus client
02 02-collections-and-singletons In-memory Collection[T] and Singleton[T] with the manager
03 03-views Filtered, sorted, auto-updating views
04 04-indexed-views GroupBy views: map[K][]V from a collection
05 05-sync-polling Multi-replica sync via polling
06 06-sync-websocket Real-time sync via Directus WebSocket
07 07-schema-as-code Create collections, relations, flows programmatically
08 08-translations Multi-language content with translations
09 09-caching Redis and in-memory caching strategies
10 10-full-setup Production-style setup with config units and views

Each directory has its own README.md explaining what it demonstrates.

Directories

Path Synopsis
Basic CRUD operations with the Directus client.
Basic CRUD operations with the Directus client.
In-memory Collection[T] and Singleton[T] synced from Directus.
In-memory Collection[T] and Singleton[T] synced from Directus.
Auto-updating materialized views over a collection.
Auto-updating materialized views over a collection.
GroupBy views: map[K][]V from a collection.
GroupBy views: map[K][]V from a collection.
Poll-based sync from Directus.
Poll-based sync from Directus.
Real-time sync from Directus via WebSocket.
Real-time sync from Directus via WebSocket.
Package main demonstrates creating Directus collections with relational fields (M2O, O2M, M2M) and translations using the schema management API.
Package main demonstrates creating Directus collections with relational fields (M2O, O2M, M2M) and translations using the schema management API.
Working with Directus translations in memory.
Working with Directus translations in memory.
Caching strategies and view persistence.
Caching strategies and view persistence.
Full setup example — shows how to wire all components manually.
Full setup example — shows how to wire all components manually.
configs/products
Package products is a self-contained config unit for the "products" collection.
Package products is a self-contained config unit for the "products" collection.
configs/settings
Package settings is a self-contained config unit for the "app_settings" singleton.
Package settings is a self-contained config unit for the "app_settings" singleton.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL