Getting Started
Installation

Installation

Requirements

  • Go 1.21 or higher
  • A supported database (PostgreSQL or MySQL)

Install go-lightning

go get github.com/tracewayapp/go-lightning/lit

Database Drivers

go-lightning works with standard database/sql drivers. Install the driver for your database:

PostgreSQL

# pgx (recommended)
go get github.com/jackc/pgx/v5/stdlib
 
# or pq
go get github.com/lib/pq

MySQL

go get github.com/go-sql-driver/mysql

Verify Installation

Create a simple program to verify everything is working:

package main
 
import (
    "fmt"
    "github.com/tracewayapp/go-lightning/lit"
)
 
type User struct {
    Id    int
    Name  string
    Email string
}
 
func main() {
    lit.RegisterModel[User](lit.PostgreSQL)
    fmt.Println("go-lightning installed successfully!")
}

Run it:

go run main.go

If you see "go-lightning installed successfully!", you're ready to proceed to the Quick Start.