> For the complete documentation index, see [llms.txt](https://twharmon.gitbook.io/gosql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://twharmon.gitbook.io/gosql/master.md).

# GoSQL

## Getting Started

Get the package:

```
$ go get github.com/twharmon/gosql
```

Open a connection to a database:

```go
sqliteDB, _ := sql.Open("sqlite3", "my-db.sql")
db := gosql.New(sqliteDB)
```

Register your structs that have corresponding tables in the database:

```go
type User struct {
    ID       int `gosql:"primary"`
    Email    string
    IsActive bool
}

db.Register(User{})
```

{% hint style="warning" %}
You must register all struct types before using them with GoSQL.&#x20;
{% endhint %}
