Skip to content

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

go get github.com/go-gamma/dynorm

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:

export AWS_REGION=us-east-1
export AWS_ACCESS_KEY_ID=your-access-key
export AWS_SECRET_ACCESS_KEY=your-secret-key
# ~/.aws/credentials
[default]
aws_access_key_id = your-access-key
aws_secret_access_key = your-secret-key

# ~/.aws/config
[default]
region = us-east-1

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:

go run main.go
# Output: Table name: users

Next Steps