Skip to main content
In this Go quickstart you will learn how to:
  • Retrieve database credentials
  • Install the libSQL client
  • Connect to a remote Bunny Database
  • Execute a query using SQL

Quickstart

1

Retrieve database credentials

You will need an existing database to continue. If you don’t have one, create one.Navigate to Dashboard > Edge Platform > Database > [Select Database] > Access to find your database URL and generate an access token.
You should store these as environment variables to keep them secure.
2

Install libsql-client-go

Install the libSQL client package:
3

Initialize a new client

Create a database connection with your database URL and auth token:
4

Execute a query using SQL

You can execute a SQL query against your database using Query() for reads or Exec() for writes:
If you need to use placeholders for values, you can do that:

Placeholders

libSQL supports the use of positional and named placeholders within SQL statements:
libSQL supports the same named placeholder characters as SQLite — :, @ and $.

Executing Writes

Use Exec() for INSERT, UPDATE, and DELETE statements:

Transactions

You can use transactions to execute multiple statements atomically:

Prepared Statements

For repeated queries, you can use prepared statements for better performance:

Context Support

The libSQL client supports Go’s context for timeout and cancellation:
Last modified on July 20, 2026