Installation¶
Requirements¶
Before installing Dynorm, ensure you have:
- Go 1.24 or later
- AWS credentials configured (via environment variables, IAM role, or AWS config file)
- DynamoDB tables with appropriate schema (or use the schema helpers)
Install via Go Modules¶
Dependencies¶
Dynorm uses the AWS SDK for Go v2. The following packages are automatically installed:
| Package | Purpose |
|---|---|
github.com/aws/aws-sdk-go-v2 | Core AWS SDK |
github.com/aws/aws-sdk-go-v2/service/dynamodb | DynamoDB client |
github.com/aws/aws-sdk-go-v2/feature/dynamodb/expression | Expression builder |
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue | Marshalling |
github.com/oklog/ulid/v2 | ULID generation |
AWS Configuration¶
Dynorm automatically uses the default AWS credential chain. Configure your environment:
When running in AWS Lambda, credentials are automatically provided via the execution role. Just ensure your role has DynamoDB permissions.
Verify Installation¶
Create a simple test file:
package main
import (
"fmt"
"github.com/go-gamma/dynorm"
)
type User struct {
dynorm.Entity
Email string
}
type UserRepository struct {
dynorm.Repository[User]
}
func main() {
repo := &UserRepository{}
fmt.Printf("Table name: %s\n", repo.GetTableName())
}
Run with:
Next Steps¶
- Quick Start - Build your first entity and repository
- Configuration - Configure table prefixes and options