This directory contains example code demonstrating how to use DeCube components.
- Location:
quickstart/ - Description: Basic introduction to DeCube components
- Run:
cd quickstart && go run main.go
- Location:
snapshot-example/ - Description: Demonstrates snapshot creation, querying, and management
- Run:
cd snapshot-example && go run main.go
Before running examples:
-
Start DeCube services:
docker-compose up -d
-
Wait for services to be ready:
./scripts/health-check.sh
-
Install dependencies:
go mod download
Each example directory contains:
main.go: Example codeREADME.md: Example-specific documentation
To run an example:
cd examples/<example-name>
go run main.goWhen creating new examples:
- Create a new directory under
examples/ - Add a
main.gofile with your example code - Add a
README.mdexplaining what the example demonstrates - Follow the existing code style and patterns
- Update this README to include your example
package main
import (
"fmt"
"log"
)
func main() {
fmt.Println("Example: Description")
// Example code here
if err := doSomething(); err != nil {
log.Fatal(err)
}
fmt.Println("Example completed successfully!")
}We welcome example contributions! See CONTRIBUTING.md for guidelines.
Examples should:
- Be clear and well-documented
- Demonstrate real-world use cases
- Include error handling
- Be easy to understand and modify