- Notifications
You must be signed in to change notification settings - Fork31
tursodatabase/go-libsql
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
libSQL is an open source, open contribution fork of SQLite.This source repository contains libSQL API bindings for Go.
This package comes with a precompiled native libraries.Currently onlylinux amd64,linux arm64,darwin amd64 anddarwin arm64 are supported.We're working on adding support for more platforms.
- In-memory databases and local database files, like SQLite
- Remote database access to libSQL server
- In-app replica that syncs with a libSQL server
go get github.com/tursodatabase/go-libsqlgo-libsql usesCGO to make calls to LibSQL. You must build your binaries withCGO_ENABLED=1.
To connect to the database one needs to create alibsql.Connector using one of the factory functions:libsql.NewEmbeddedReplicaConnector orlibsql.NewEmbeddedReplicaConnectorWithAutoSync.
Here's an example of obtaining asql.DB object fromdatabase/sql package:
dbPath := // Path do db file on local diskprimaryUrl := // URL to primary database instanceconnector := NewEmbeddedReplicaConnector(dbPath, primaryUrl, authToken)db := sql.OpenDB(connector)defer db.Close()Oncesql.DB object is created one can use it as any other database that supportsdatabase/sql package.
If the connector is created withlibsql.NewEmbeddedReplicaConnectorWithAutoSync then it will automatically fetch updates from a primary periodically.
For connectors created withlibsql.NewEmbeddedReplicaConnector we need to fetch updates manually by callingconnector.Sync
Module with usage examples can be found inexample directory.
This project is licensed under theMIT license.
Unless you explicitly state otherwise, any contribution intentionally submittedfor inclusion in libSQL by you, shall be licensed as MIT, without any additionalterms or conditions.
About
libSQL API for Go
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors14
Uh oh!
There was an error while loading.Please reload this page.