plyGO Integration
goTableView is the perfect companion for plyGO, a data pipeline library for Go. This guide shows you how to visualize your plyGO results.
What You'll Learn
- Displaying plyGO query results
- Combining filtering and visualization
- Working with aggregations
- Real-world data pipeline examples
Why goTableView + plyGO?
plyGO transforms and filters data. goTableView displays it beautifully.
Data → plyGO Pipeline → goTableView → User sees resultsPerfect for:
- Exploring filtered datasets
- Debugging data transformations
- Presenting query results
- Data analysis workflows
Basic Integration
Example 1: Simple Filter and Display
go
package main
import (
"github.com/mansoldof/goTableView"
"github.com/frpm/plygo"
)
type Employee struct {
Name string `gotableview:"Name"`
Department string `gotableview:"Department"`
Age int `gotableview:"Age"`
Salary float64 `gotableview:"Salary"`
}
func main() {
employees := []Employee{
{"Alice", "Engineering", 30, 75000},
{"Bob", "Sales", 25, 60000},
{"Carol", "Engineering", 35, 85000},
{"David", "Marketing", 28, 65000},
{"Eve", "Engineering", 32, 80000},
}
// Filter with plyGO, display with goTableView
result := plygo.From(employees).
Where("Department").Equals("Engineering").
OrderBy("Salary").Desc().
Collect()
gotableview.FromStructs("Engineering Team", result).Show()
} Screenshot: Filtered employee table showing only Engineering department, sorted by salary descending
Filtering and Displaying
Example 2: Multiple Filters
go
package main
import (
"github.com/mansoldof/goTableView"
"github.com/frpm/plygo"
)
type Product struct {
ID int `gotableview:"Product ID"`
Name string `gotableview:"Name"`
Category string `gotableview:"Category"`
Price float64 `gotableview:"Price"`
Stock int `gotableview:"Stock"`
}
func main() {
products := []Product{
{1, "Laptop", "Electronics", 999.99, 15},
{2, "Desk", "Furniture", 299.99, 8},
{3, "Mouse", "Electronics", 24.99, 50},
{4, "Chair", "Furniture", 199.99, 12},
{5, "Monitor", "Electronics", 349.99, 20},
{6, "Keyboard", "Electronics", 74.99, 30},
}
// Find electronics over $50 with stock > 10
result := plygo.From(products).
Where("Category").Equals("Electronics").
Where("Price").GreaterThan(50.0).
Where("Stock").GreaterThan(10).
OrderBy("Price").Desc().
Collect()
gotableview.FromStructs("Premium Electronics in Stock", result).Show()
} Screenshot: Filtered products showing only electronics priced over $50 with sufficient stock
Field Selection
Example 3: Select Specific Fields
go
package main
import (
"github.com/mansoldof/goTableView"
"github.com/frpm/plygo"
)
type Employee struct {
ID int
Name string
Department string
Email string
Phone string
Salary float64
StartDate string
}
func main() {
employees := loadEmployees() // Load from database
// Select only specific fields
result := plygo.From(employees).
Select("Name", "Department", "Salary").
Where("Salary").GreaterThan(70000.0).
OrderBy("Salary").Desc().
Collect()
// Result is []map[string]any
gotableview.FromMaps("High Earners", result).Show()
} Screenshot: Table showing only Name, Department, and Salary columns for high earners
FromMaps for Selected Fields
When using plyGO's Select(), the result is []map[string]any. Use FromMaps() instead of FromStructs() to display it.
Aggregations
Example 4: Group By and Display
go
package main
import (
"github.com/mansoldof/goTableView"
"github.com/frpm/plygo"
)
type Sale struct {
Date string
Product string
Category string
Amount float64
Quantity int
}
func main() {
sales := loadSalesData() // Load sales records
// Group by category and sum amounts
result := plygo.From(sales).
GroupBy("Category").
Sum("Amount", "TotalRevenue").
Sum("Quantity", "TotalUnits").
OrderBy("TotalRevenue").Desc().
Collect()
gotableview.FromMaps("Sales by Category", result).Show()
} Screenshot: Aggregated sales data showing categories with total revenue and units sold
Large Datasets with Pagination
Example 5: Filter Large Dataset
go
package main
import (
"github.com/mansoldof/goTableView"
"github.com/frpm/plygo"
"time"
)
type LogEntry struct {
ID int `gotableview:"ID"`
Timestamp time.Time `gotableview:"Time"`
Level string `gotableview:"Level"`
Message string `gotableview:"Message"`
}
func main() {
// Load 10,000 log entries
logs := loadLogs()
// Filter for errors in the last hour
oneHourAgo := time.Now().Add(-1 * time.Hour)
result := plygo.From(logs).
Where("Level").Equals("ERROR").
Where("Timestamp").GreaterThan(oneHourAgo).
OrderBy("Timestamp").Desc().
Collect()
gotableview.FromStructsPaginated("Recent Errors", result, 50).
WithSearch().
Show()
} Screenshot: Paginated error logs from last hour with search functionality
Complex Queries
Example 6: Multi-stage Pipeline
go
package main
import (
"github.com/mansoldof/goTableView"
"github.com/frpm/plygo"
)
type Order struct {
OrderID int `gotableview:"Order ID"`
Customer string `gotableview:"Customer"`
Product string `gotableview:"Product"`
Amount float64 `gotableview:"Amount"`
Status string `gotableview:"Status"`
Region string `gotableview:"Region"`
}
func main() {
orders := loadOrders()
// Complex pipeline:
// 1. Filter completed orders
// 2. Only West region
// 3. Amount > $100
// 4. Sort by amount
result := plygo.From(orders).
Where("Status").Equals("Completed").
Where("Region").Equals("West").
Where("Amount").GreaterThan(100.0).
OrderBy("Amount").Desc().
Limit(100). // Top 100
Collect()
gotableview.FromStructsPaginated("Top 100 West Region Orders", result, 50).
SearchInColumns("Customer", "Product").
Show()
} Screenshot: Top 100 filtered orders with multi-criteria filtering and search
Data Transformation
Example 7: Transform Before Display
go
package main
import (
"github.com/mansoldof/goTableView"
"github.com/frpm/plygo"
)
type RawEmployee struct {
FirstName string
LastName string
Department string
Salary float64
}
type DisplayEmployee struct {
FullName string `gotableview:"Name"`
Department string `gotableview:"Department"`
Salary float64 `gotableview:"Annual Salary"`
Monthly float64 `gotableview:"Monthly Pay"`
}
func main() {
rawData := loadRawEmployees()
// Transform data
var transformed []DisplayEmployee
for _, emp := range rawData {
transformed = append(transformed, DisplayEmployee{
FullName: emp.FirstName + " " + emp.LastName,
Department: emp.Department,
Salary: emp.Salary,
Monthly: emp.Salary / 12,
})
}
// Filter and display
result := plygo.From(transformed).
Where("Salary").GreaterThan(70000.0).
OrderBy("Salary").Desc().
Collect()
gotableview.FromStructs("Employee Compensation", result).Show()
} Screenshot: Transformed employee data with calculated monthly pay column
Joins and Relationships
Example 8: Combining Related Data
go
package main
import (
"github.com/mansoldof/goTableView"
"github.com/frpm/plygo"
)
type Employee struct {
ID int
Name string
DeptID int
}
type Department struct {
ID int
Name string
}
type EmployeeWithDept struct {
EmployeeName string `gotableview:"Employee"`
DepartmentName string `gotableview:"Department"`
}
func main() {
employees := []Employee{
{1, "Alice", 1},
{2, "Bob", 2},
{3, "Carol", 1},
}
departments := []Department{
{1, "Engineering"},
{2, "Sales"},
}
// Manual join (plyGO doesn't have built-in joins yet)
deptMap := make(map[int]string)
for _, d := range departments {
deptMap[d.ID] = d.Name
}
var combined []EmployeeWithDept
for _, e := range employees {
combined = append(combined, EmployeeWithDept{
EmployeeName: e.Name,
DepartmentName: deptMap[e.DeptID],
})
}
result := plygo.From(combined).
OrderBy("DepartmentName").
Collect()
gotableview.FromStructs("Employees by Department", result).Show()
} Screenshot: Combined employee and department data in a single table
Real-World Use Cases
Example 9: Customer Analytics
go
package main
import (
"github.com/mansoldof/goTableView"
"github.com/frpm/plygo"
"time"
)
type Customer struct {
ID int `gotableview:"ID"`
Name string `gotableview:"Customer"`
TotalOrders int `gotableview:"Orders"`
TotalSpent float64 `gotableview:"Revenue"`
LastOrder time.Time `gotableview:"Last Order"`
Status string `gotableview:"Status"`
}
func main() {
customers := loadCustomerData()
// Find VIP customers: 10+ orders, $5000+ spent, active in last 30 days
thirtyDaysAgo := time.Now().Add(-30 * 24 * time.Hour)
result := plygo.From(customers).
Where("TotalOrders").GreaterThan(10).
Where("TotalSpent").GreaterThan(5000.0).
Where("LastOrder").GreaterThan(thirtyDaysAgo).
OrderBy("TotalSpent").Desc().
Collect()
gotableview.FromStructsPaginated("VIP Customers", result, 50).
WithColumnSelector().
Show()
} Screenshot: VIP customer list with multiple filtering criteria and column selector
Example 10: Inventory Management
go
package main
import (
"github.com/mansoldof/goTableView"
"github.com/frpm/plygo"
)
type InventoryItem struct {
SKU string `gotableview:"SKU"`
Product string `gotableview:"Product"`
Category string `gotableview:"Category"`
Stock int `gotableview:"Current Stock"`
MinStock int `gotableview:"Min Required"`
Price float64 `gotableview:"Unit Price"`
StockValue float64 `gotableview:"Stock Value"`
}
func main() {
inventory := loadInventory()
// Add calculated field
for i := range inventory {
inventory[i].StockValue = float64(inventory[i].Stock) * inventory[i].Price
}
// Find items needing reorder (stock < minimum)
result := plygo.From(inventory).
Where("Stock").LessThan("MinStock"). // Compare with another field
OrderBy("StockValue").Desc().
Collect()
gotableview.FromStructs("Items Needing Reorder", result).Show()
} Screenshot: Inventory reorder report showing items below minimum stock levels
Best Practices
1. Use Appropriate Display Methods
go
// For full structs
result := plygo.From(data).Where(...).Collect()
gotableview.FromStructs("Title", result).Show()
// For selected fields (returns maps)
result := plygo.From(data).Select("Field1", "Field2").Collect()
gotableview.FromMaps("Title", result).Show()2. Add Pagination for Large Results
go
// Instead of:
result := plygo.From(largeDataset).Where(...).Collect()
gotableview.FromStructs("Data", result).Show() // ❌ Slow for 1000+ items
// Do this:
result := plygo.From(largeDataset).Where(...).Collect()
gotableview.FromStructsPaginated("Data", result, 100).Show() // ✅ Fast3. Order Before Display
go
// Always order your data for better UX
result := plygo.From(data).
Where(...).
OrderBy("ImportantField").Desc(). // ✅ Users see ordered data
Collect()
gotableview.FromStructs("Ordered Data", result).Show()4. Combine Search Features
go
// Let users search within filtered results
result := plygo.From(data).
Where("Category").Equals("Electronics").
OrderBy("Price").Desc().
Collect()
gotableview.FromStructsPaginated("Electronics", result, 50).
WithColumnSelector(). // User can search any column
Show()Common Patterns
Pattern 1: Filter → Display
go
result := plygo.From(data).Where(...).Collect()
gotableview.FromStructs("Filtered", result).Show()Pattern 2: Filter → Paginate → Search
go
result := plygo.From(data).Where(...).OrderBy(...).Collect()
gotableview.FromStructsPaginated("Data", result, 50).WithSearch().Show()Pattern 3: Select → Display Maps
go
result := plygo.From(data).Select("Field1", "Field2").Collect()
gotableview.FromMaps("Selected Fields", result).Show()What's Next?
- See Basic Examples for non-plyGO examples
- Check Advanced Examples for complex scenarios
- Read the API Reference for all display options
- Visit plyGO Documentation for query syntax
Perfect Combination
plyGO filters and transforms your data. goTableView presents it beautifully. Together, they create powerful data exploration tools!