# 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 %}
