项目作者: riyaz-ali

项目描述 :
Golang library to build sqlite extensions
高级语言: Go
项目地址: git://github.com/riyaz-ali/sqlite.git
创建时间: 2020-10-17T06:35:42Z
项目社区:https://github.com/riyaz-ali/sqlite

开源协议:Other

下载


SQLite Extensions

Go v1.14
CGO
Godoc

Overview

sqlite package provides a low-level interface that allows you to build sqlite extensions that can be loaded dynamically at runtime
or linked statically at build-time (experimental)

Installation

This package can be installed with go get as:

  1. $ go get -u go.riyazali.net/sqlite

sqlite is a cgo package and requires a working c compiler.

Usage

To build an sqlite extension, you need to build your project with -buildmode=c-shared. That would emit
a .so file (or .dll on windows), which you can then load into sqlite.

Consider as an example, the sample upper module in _examples/. To build it, you’d use something similar to:

  1. $ go build -buildmode=c-shared -o upper.so _examples/upper

which would emit an upper.so in the current directory. Now, to use it with (say) the sqlite3 shell, you could do something like

  1. $ sqlite3
  2. > .load upper.so
  3. > SELECT upper("sqlite3");
  4. SQLITE3
  5. > .exit

Features

Each of the support feature provides an exported interface that the user code must implement. Refer to code and godoc
for more details.

License

MIT License Copyright (c) 2020 Riyaz Ali

Refer to LICENSE for full text.