Get started with Turso and Go using the libSQL client in a few simple steps.
database/sql
to provide the usual methods you’d expect when working with databases in Go.
go-libsql
package uses CGO. You can use github.com/tursodatabase/libsql-client-go/libsql
instead, but it doesn’t support embedded replicas.Retrieve database credentials
.env
.Install
Local / Embedded Replicas
Remote only
Connect
Embedded Replicas
Local only
Remote only
Execute
sql.DB
as an argument:func main()
call queryUsers
and pass in the pointer to sql.DB
:Sync (Embedded Replicas only)
Sync()
on the connector to sync your local database with the primary database.WithSyncInterval
option: