All the boilerplate needed for a Turso or LibSQL golang project to work on all platforms.
Go to file
Mason Payne cfd22dfc9c refactor into an importable library and keep an example 2024-08-22 00:05:50 -06:00
.idea initial commit 2024-08-19 01:07:19 -06:00
examples/basic-usage refactor into an importable library and keep an example 2024-08-22 00:05:50 -06:00
db.go refactor into an importable library and keep an example 2024-08-22 00:05:50 -06:00
embedded.go refactor into an importable library and keep an example 2024-08-22 00:05:50 -06:00
go.mod refactor into an importable library and keep an example 2024-08-22 00:05:50 -06:00
go.sum initial commit 2024-08-19 01:07:19 -06:00
readme.md add windows info to readme 2024-08-19 01:12:28 -06:00
remote-only.go refactor into an importable library and keep an example 2024-08-22 00:05:50 -06:00

readme.md

LibSQL Boilerplate Golang

Copy this repo to have a golang application that is already set up to work with libSQL.

How to use

  1. Copy this repo to your new project

  2. Modify two files.

    • go.mod needs a new package name.
    • main.go needs to use the package name to import from {{packageName}}/db
  3. Set up your environment variables

    • LIBSQL_AUTH_TOKEN
    • LIBSQL_DATABASE_URL

Windows?

This project is designed to use an embedded replica by default but Windows is not supported by libSQL. So this project has special build tags for Windows and sets up a libSQL remote driver. If your build target doesn't include Windows you can remote the file db/remote-only.go.